Disable password access through SSH?

16,025

Solution 1

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

PasswordAuthentication no

You might need to reload the ssh service

sudo service ssh reload

That should do the trick ;)

For more options type man sshd_config in to your terminal.

Solution 2

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:
16,025

Related videos on Youtube

Evan Kroske
Author by

Evan Kroske

Updated on September 17, 2022

Comments

  • Evan Kroske
    Evan Kroske over 1 year

    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?

  • LassePoulsen
    LassePoulsen almost 14 years
    See this thread for more hints: ubuntu.stackexchange.com/questions/2271/…
  • David Bailey
    David Bailey over 8 years
    Or just lock and delete the password for the root account. (Assuming the default user has sudo access)
  • bubakazouba
    bubakazouba almost 8 years
    do i need to restart ssh after that?
  • pa4080
    pa4080 over 6 years
    Of course, you must.