Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I'm setting up a server for backing up my desktop box remotely. I want to prevent remote password access to the server, permitting only users with private keys (AKA my desktop box) to access it. How can I block remote password access while allowing physical password access to the server?

share|improve this question
up vote 31 down vote accepted

Just insert the following to the sshd config on the server (/etc/ssh/sshd_config)

PasswordAuthentication no

That should do the trick ;)

For more options type man sshd_config in to your terminal.

share|improve this answer
See this thread for more hints:… – LassePoulsen Aug 15 '10 at 21:51
do i need to restart ssh after that? – bubakazouba Jun 22 at 3:27

Just a note about SSH access to servers - you may also want to disable the root user from ssh, this way at least hackers will have to guess the username as well.

PermitRootLogin no
share|improve this answer
Or just lock and delete the password for the root account. (Assuming the default user has sudo access) – David Bailey Oct 6 '15 at 17:57

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.