简体   繁体   中英

Allowing users to ssh to an EC2 Ubuntu instance?

The default way to access an new EC2 instance is by using your key-pair.

How can I allow other users to connect to my instance, without giving them my keys? (Ideally, I'd like them to be prompted for user/password on login)

Edit /etc/ssh/sshd_config and set PasswordAuthentication to yes .

Enter the command sudo /etc/init.d/sshd reload .

Then you could Create a User with:

useradd USERNAME

(check the man for options on how to set home directory etc...)

Then

passwd USERNAME 

You will be prompted for a New password

To save some Ubuntu neophytes like myself some time, newer Ubuntu instances no longer use sshd reload. Instead it is asking for:

sudo restart ssh

Please see this SO link for more details: https://superuser.com/questions/214799/no-etc-init-d-sshd-file-ubuntu-ec2

sudo vi /etc/ssh/sshd_config 
:s/PasswordAuthentication no/PasswordAuthentication yes/   
:wq

sudo /etc/init.d/sshd reload

sudo useradd newuser

it prompts you and you enter password.

you wish to change a passwd?

sudo passwd newuser

Now your users can login with

ssh new_user@aws.blah.your_public_ip 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM