This is the recommended method to add SSH authentication for system users (other than root) with public/private keypairs.
adduser tester
chsh tester
su tester
ssh-keygen
chmod -v 700 ~/.ssh/id_rsa*
authorized_keys
for user. Add the public key generated plus any other public keys intended for use with SSH clientscat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh -i ~/.ssh/id_rsa_myserver tester@<public_ip>
You can debug issues buy using the -v flag with the ssh command and checking the secure/auth log on the server.
Important! This is not a recommended best practice and should not be used on production servers or any instances that contain sensitive information. Plain user authentication with PAM is insecure compared to public key authentication (the default).
Consider using an identity server such as an LDAP server to scale users if required.
Tested with RightImage Ubuntu 10.04 i386 v5.5.9.
sed -e "s/#PasswordAuthentication yes/PasswordAuthentication yes/g" -i /etc/ssh/sshd_config
apt-get update && apt-get -y install denyhosts
/etc/init.d/ssh restart
adduser tester
You can now log into the instance with system user accounts, while preserving public key authentication for the root user.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.