How can I create a user on CentOS 5.6, which cannot login with a password. I.E. they can only login and SSH using public key authentication.

 useradd myuser -d /their-home-dir

Will that do it, without calling passwd?

link|improve this question

48% accept rate
feedback

2 Answers

up vote 7 down vote accepted

Yes, that will do it but you should add some keys to ~/.ssh/authorized_keys of course.

link|improve this answer
feedback

If you want to enforce only pubkey auth, then you need to modify your /etc/ssh/sshd_config , and set

PasswordAuthentication no
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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