Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to ban password use on Ubuntu Hardy?

I will be using Ubuntu instances on EC2 where passwords are not used but private keys are used to login via ssh.

Thanks for help.

share|improve this question
up vote 4 down vote accepted

Change the PasswordAuthentication line in /etc/ssh/sshd_config to no:


#PasswordAuthentication yes


PasswordAuthentication no

And the restart sshd:

/etc/init.d/sshd restart

You should be good to go.

share|improve this answer
Oh, make sure you have the keys working BEFORE you make this change :) – d34dh0r53 Mar 29 '10 at 3:54
Thanks for this. I will give it a go. – April Mar 29 '10 at 4:07
Well I have modified the file. But cant restart sshd, I am getting error 'restart: command not found'. Another thing is there is no file called sshd in location/etc/init.d/. There is a file called ssh. So what do I do next? – April Mar 29 '10 at 8:13
well, i have finally worked out how to retstart ssh but the system is still promting to enter a password if run command passwd. Doesnt seems like it has been fixed properly. – April Mar 29 '10 at 8:29
Passwd is used to change the current password. It has no effect on if you may log in with the password or not. If you don't want a password promt there you have to run passwd as superuser. sudo passwd. You can setup sudo not to use password, using the sudoers file. – pehrs Mar 29 '10 at 8:35

Your Answer


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.