Monday, 6 November 2017

linux - ssh: execute privileged command when a non-root user logs in?


I am trying to run a command/script that requires root privileges when a non-root user logs into ssh


This unfortunately means I cannot use ~/.bashrc or /etc/bashrc


I also tried /etc/ssh/sshrc but it has the same problem, the command executes as the logged in user.


I see /etc/profile.d/ does something but not sure how to use it or if it will have the same problem.


sshd does run as root so I am hoping it can be taught to do this somehow


I do need to know the ip of the login for the command.


Thanks for any ideas!


added: sudo is not possible because it's for a non-privileged user without sudo rights



Answer



Use pam_exec as a PAM session module.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...