1

This is my first time setting up a server, and need some help using SSH.

My client is PuTTY on Windows 10, server is hosted on an Ubuntu Server 14.04 VM.

I can login to the server using password, but I'd like to transition to key-based authentication. But so far, my efforts have been in vain.

Steps I have taken:

  • Using PuTTY, I generated a pair of keys;
  • Using PSCP, I transfered the public key to /home/user/.ssh/authorized keys;

Thus the .ssh folder structure is:

total 12
-rw-rw-r-- 1 user user  468 Oct 11 15:58 authorized_keys
-rw------- 1 user user 1675 Oct 11 15:57 id_rsa
-rw-r--r-- 1 user user  393 Oct 11 15:57 id_rsa.pub
  • I modified some lines from /etc/ssh/sshd_config:

Full file: http://pastebin.com/EGJDE9vB

Lines I changed:

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

I also tried to uncomment

#AuthorizedKeysFile %h/.ssh/authorized_keys

with no results.

  • I restarted the server with sudo service ssh restart. I tried to restart the VM, too.

This doesn't work; I still can authenticate to the server using password only from PuTTY.

Can someone enlighten me? I see the steps above are what are commonly used to disable password, so I am confused.

Thanks in advance.

Ferduun
  • 23
  • 1
  • 4
  • 1
    Could you post the **whole** of your `sshd_config`? It is perfectly possible (by specifying parameters more than once) to have whole swathes of config ignored. – MadHatter Oct 11 '15 at 16:44
  • 1
    Also, the logs from the server would help. – Jenny D Oct 12 '15 at 12:31

1 Answers1

2

The file you posted contains the line

#PasswordAuthentication no

You need to remove the # for this line to be applied.

Richard
  • 739
  • 8
  • 15
  • Thanks, but now server is refusing my key... – Ferduun Oct 11 '15 at 17:22
  • It probably means, that ~/.ssh/authorized_keys does not contain your public key in which case you are now locked out of your server. Use physical access or the recovery console of your hoster to fix it. Maybe you are just using ssh wrong. Try `ssh -i /path/to/your/id_rsa your_host`. – Richard Oct 11 '15 at 17:40
  • What should I do if I am using ssh on a Windows 10? – Michael Jun 03 '22 at 05:15