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
  • 2
    If you don't have write access to `/etc/ssh/sshd_config`, this is a Super User question. – Esa Jokinen May 18 '17 at 10:35
  • A decent alternative, which does not require root privileges, is to use a very strong password on your account. – kasperd May 29 '17 at 06:00
  • @EsaJokinen If it's a unix question, it'll be better off at [Unix/Linux](https://unix.stackexchange.com) instead. – Jenny D Jun 12 '17 at 10:31
  • If I knew how to get this migrated, I would migrate it to unix/linux... just posted it here because all the other answers I found dealing with similar problems were here. – fifaltra Jun 12 '17 at 14:05

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,533
  • 8
  • 72
  • 99