0

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.

closed as off-topic by MadHatter, Jenny D, Ward, kasperd, Stefan Lasiewski Oct 13 '15 at 20:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – MadHatter, Jenny D, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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
2

The file you posted contains the line

#PasswordAuthentication no

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

  • 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

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