开发者

EC2 non root user login

Is there a way to log into an EC2 ubuntu ami or a way to set up an ubuntu ami so that non-root users can log in? I tried creating a user and logging in with the associated password. I开发者_运维技巧 also tried using the private key, copied the authorized-keys file into the .ssh directory of the non-root user's home directory and tried to log in to the box with that user account id. Neither method worked.

Thanks in advance.


So, this works, but the missing high-order bit of information here has to do with setting the right permission on the authorized-keys file in the home directory for the user. So, I copied /root/.ssh/authorized-key to /home/user, then did with

cp -r /root/.ssh /home/user

chown -R user /home/user/.ssh

This allowed me to use the keypair.pem file to log in.


Make sure you are sending your AWS keypair as the identity file, i.e.

ssh -i ~/.ssh/keypair.pem user@ec2-174-129-xxx-xx.compute-1.amazonaws.com

Also check that SSH is enabled in your security group


Assuming you would like to have users log in with a password so they need not supply a key every time, all you must do is turn on the ability to SSH in with a password. This option is turned off by default in all Linux AMIs.

vi, nano, pico, etc. into the following file with root privileges:

sudo vi /etc/ssg/sshd_config

Change the following setting to yes:

PasswordAuthentication = yes

Finally you must restart SSH (Since you are SSHed onto a remote machine, a simple reboot is fine.)

That's it! Of course, you must still add users with the adduser command and give them passwords with the passwd command for them to be able to login to your AMI. Checkout this link for more info on the OpenSSH SSH client configuration files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜