Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 980 Bytes

Connect_to_EC2_Without_key_pair.md

File metadata and controls

58 lines (39 loc) · 980 Bytes

Connect to EC2 Instance without key pair

Prerequisite

  • root login (OR) sudo login

Login

Login using key pair, then follow the below steps

Create new login user [Optional]

# Add user with home directory & bash shell
sudo useradd -s /bin/bash -d /home/{home directory} -m {user name}
# Add bash shell
sudo chsh -s /bin/bash {userName}
# Make sudo user
sudo usermod -aG sudo {username}
# Change pass
sudo passwd {userName}

Enable password & SSH authentication

  • Open sudo vi /etc/ssh/sshd_config and modify the following

** To enable password authentication, uncomment

#PasswordAuthentication yes

** To enable root login, uncomment

#PermitRootLogin yes

** To enable ssh key login, uncomment

#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

** Add user name in

AllowUsers thirumal ubuntu

** After modification, restart ssh:

sudo service ssh restart