1

I would like to disable ssh password authentication for my user account on a server where I don't have root priviledges, so that I can only log in via publickey authentication.

Everything I found on the topic involved changing /etc/ssh/sshd_config, which I can't do obviously.

Is this possible at all?

I found this answer to a similar question, but it's not clear to me whether it does what I want without side effects. And whether I can do it without sudo.

fifaltra
  • 129
  • 4

1 Answers1

4

Short answer: No.

Apparently, the solution is to modify /etc/ssh/sshd_config by adding a block like this:

Match user myuser
PasswordAuthentication no

This obviously requires root privilege.

The linked answer in your question uses usermod to lock the user password. This also requires root privilege.

Modifying SSH client user-specific config file ~/.ssh/config does not help in your case. This is simply because this file will be applied when connecting from your box and not when receiving SSH connections (client side!).

Khaled
  • 36,903