What Is SSH?
Secure shell (SSH) is the secure method of remotely connecting to another server. By default SSH listens for connections on port 22 and demon service of SSH is sshd. The ssh configuration file is located at /etc/ssh/sshd.config
and is used for any additional configurations regarding listening port, location of keys exchanging between the two sessions of the client and server and vice versa etc.
Whenever you have to configure the SSH user on Amazon Linux just follow the following steps:
yum install openssh
service sshd restart
chkconfig sshd on
/sbin/iptables –A INPUT –n state --state NEW –n tcp –p tcp --dport 22 –j ACCEPT
Steps to create SSH user in AWS Linux machine:
sudo useradd -g ec2-user newuser
Sudo groupadd newuser
sudo su newuser
cd /home/newuser
ssh-keygen -b 1024 -f newuser -t dsa
It will ask for passphrase then hit ‘ENTER’ key
After you execute this command two files will be created as shown below
$ mkdir .ssh
$ chmod 700 .ssh
$ cat newuser.pub > .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys
$ chown newuser:newuser .ssh
$ chown newuser:newuser .ssh/authorized_keys
Now you can log in directly as the user newuser to your Amazon EC2 instance.