Guest User

Untitled

a guest
Dec 21st, 2017
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. 1. Login to your EC2 instance using your .pem file
  2.  
  3. ssh -i your_pem_file.pem ubuntu@ec2-________.compute-1.amazonaws.com
  4.  
  5. 2. Create a new user that will access the instance using a password:
  6.  
  7. $ sudo useradd -s /bin/bash -m -d /home/USERNAME -g root USERNAME
  8. where:
  9.  
  10. -s /bin/bash : use /bin/bash as the standard shell
  11. -m -d /home/USERNAME : create a home directory at /home/USERNAME
  12. -g root : add to group root
  13. USERNAME : the username of the new user
  14.  
  15. 3. Create a strong password for the new user:
  16.  
  17. $ sudo passwd USERNAME
  18. Enter new UNIX password:
  19. Retype new UNIX password:
  20.  
  21. 4. Add user to sudoers file by using sudo visudo and add the following line:
  22.  
  23. USERNAME ALL=(ALL:ALL) ALL
  24.  
  25. 5. Enable password authentication by editing /etc/ssh/sshd_config: change PasswordAuthentication no to PasswordAuthentication yes
  26.  
  27. 6. Restart ssh:
  28.  
  29. sudo /etc/init.d/ssh restart
  30. Logout of your instance (exit) and try your new login without the .pem file:
  31.  
  32. $ ssh USERNAME@ec2-________.compute-1.amazonaws.com
  33. USERNAME@ec2-________.compute-1.amazonaws.com's password:
Add Comment
Please, Sign In to add comment