SSH script with SSH keys and sudo privileges
I have a additional questions regarding SSH keys:
If you connect using SSH with SSH keys and run commands which require sudo privileges, how do you do this? With a password, you would run the sudo command and enter a pwd for more privileges, but how to do this in a script? This question is related to the following thread: Quote:
|
Welcome.
You'll have to work through it in several steps, first manually then in a more automated fashion. You'll probably want to make a separate key for this activity, then add command="sudo something in the public key which you've placed in authorized_keys on the server. For that, see the manual page for sshd in the section on "authorized_keys file format" Code:
man sshd Code:
man sudoers
The idea is to use sudo with the least amount of privilege possible to get the job done. |
Guess the actual question is: how to configure /etc/sudoers
Here is an example: Code:
teddy ALL=NOPASSWD: /sbin/halt "", /sbin/reboot "", /bin/umount /dev/cdrom |
Thank you both, this helped me a lot. I wasn't sure if I had to modify sudoers, but it seems the way to go.
|
All times are GMT -5. The time now is 02:59 AM. |