I am trying to set the scp as a specific user with NOPASSWD.
alice ALL = (bob:ALL) NOPASSWD: /usr/bin/scp
As I did understand from this question.
However when I save using my visudo I still can't run sudo -u bob /usr/bin/scp bob@scp_client:upload_this_file
.
What should be included within the command to allow no password scp for alice as bob (but not as root).
Note: I did see this, also I feel that everything is in the correct order in my sudoers file as I know about the order of commands like you can learn here.
The entire visudo file:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults insults
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# Dropped this as it doesn't really matter..
# User alias specification
# Dropped this as it doesn't really matter..
# Cmnd alias specification
# Dropped this as it doesn't really matter..
# User privilege specification
root ALL=(ALL:ALL) ALL
# We have admin groups (Todo: make this smaller)
%admin ALL=(ALL) ALL
%sudo ALL=(ALL:ALL) ALL
# Include the sudoers.d
#includedir /etc/sudoers.d
# One to rule all of them
alice ALL = (bob:ALL) NOPASSWD: /usr/bin/scp
sudo
and not by SSH?ssh alice@node ; ssh bob@node
node
.ssh bob@node
- As alice I didsudo -s
to get a rootshell, and promote myself to bob withsudo -u bob -s
. - As bob I didssh bob@node
Works as expected.