Link to home
Start Free TrialLog in
Avatar of Joe Murph
Joe Murph

asked on

Authenticating Ubuntu Sudo user with public keys.

I have a Ubuntu user that I just added to the sudoer's list, but is prompted for his for his public key password when he tries to 'sudo su'. This user's public key allows him to access this Ubuntu server without a password, so I am wondering how do I configure his sudo access to not prompt for his password?
Avatar of arnold
Flag of United States of America image

Sudo su is a reduntant sudo -i or sudo -s sudo bash does it better.
Sudo su is similar to a person with a master key to a building going to a management  office where they get a key for office 203. Then ho to office 203 and use the key to open door.

Having said that. Back to your question.
Passphrase used to authenticate using a public key when connecting is not what the user is prompted for when executing sudo.
Look at /etc/sudoers using visudo, the user when executing sudo is prompted for the accounts password, not for the ssh key passphrase on the system from which the user connected.

User is logged into SystemA. User ssh user@systemB where public key auth is setup. On connection, the user is prompted for the passphrase for user@systemA key without which a connection will be denied.
Upon login, running sudo -i or -s or bash, based on sudoers and settings. You could set user not to require a password for use of sudo, but I would caution if you fo for this user, make sure to explicitly set what commands the user can run without prompting as well as do not allow the user to run any shell sh, bash, ksh, ssh, csh, tcsh, zsh and absolutely no efi tours, vi, emacs, ed,(editors include an option to run a shell command) in the same vein do not allow mail client apps as they use an editor to create a message thus allowing the user to launch an elevated shell.
Avatar of serialband
Flag of Ukraine image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial