Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm following this tuturial to setup key-based access to the SSH

I created a user. I add copy the key to the client via ssh-copy-id <username>@<host> Becasuse ssh <username>@<host> still prompts for a password I run ssh-add on the local machine. The terminal doens't prompt for a password, I can login without using a password.

But I cannot run su anymore. Every input for the password results in Authentication failure.

I tried it again. But before coping the key, I added to the sudoer file. Copied key, ssh-add. But now I cannot login to my SSH shell att all?

How can I setup a key-based SSH access with the possibiluty to use su or sudo?

share|improve this question
add comment

1 Answer

In this setup you'd have to choose between continuing to use the password for sudo and su, or setting up sudo to work without passwords (which I caution against, especially with ssh keys already being used to log in).

Make sure the account still has a password set - password logins should be prevented in the sshd configuration and NOT by setting users to disabled passwords if you want to be able to use sudo securely. In this setup, you'll still need to use passwords for local logins at the console and for sudo, but you won't be able to use them for the SSH connection.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.