It's easy enough to disable password authentication for SSH as a whole, but is there a way of allowing one user on the system the ability of logging in with a password?

The reason for this is we have several servers at rackspace and we'd like to allow rackspace access to the servers without having to set it up on all of the machines (there are lots!)

If it's simply not possible without editing the source of sshd or something that'd be good to know :)

  • This includes all future users, so no per-user rules please unless they can be applied to future users.. perhaps that's the way to do it.. – John Hunt Apr 19 '13 at 13:00

Within the sshd configuration, you can apply different settings for User, Group, Host, LocalAddress, LocalPort, and Address using the Match directive.

For what you need put this is the /etc/ssh/sshd_config file:

PasswordAuthentication no
PubkeyAuthentication yes
Match User <USERNAME>
  PasswordAuthentication yes

Add the below commands in to the /etc/ssh/sshd_config

  1. ChallengeResponseAuthentication no
  2. PasswordAuthentication no
  3. UsePAM no
  4. PubkeyAuthentication yes

Then reload SSH service :

sepahrad@pc:~$ /etc/init.d/ssh reload

  • What about my one user that needs to use a password? – John Hunt Apr 19 '13 at 14:11
  • Sorry i forgot it! You can use Match User – Sepahrad Salour Apr 19 '13 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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