Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
269
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. 2. Create a new user that will access the instance using a password:
  5.  
  6. $ sudo useradd -s /bin/bash -m -d /home/USERNAME -g root USERNAME
  7. where:
  8.  
  9. -s /bin/bash : use /bin/bash as the standard shell
  10. -m -d /home/USERNAME : create a home directory at /home/USERNAME
  11. -g root : add to group root
  12. USERNAME : the username of the new user
  13. 3. Create a strong password for the new user:
  14.  
  15. $ sudo passwd USERNAME
  16. Enter new UNIX password:
  17. Retype new UNIX password:
  18. 4. Add user to sudoers file by using sudo visudo and add the following line:
  19.  
  20. USERNAME ALL=(ALL:ALL) ALL
  21. 5. Enable password authentication by editing /etc/ssh/sshd_config: change PasswordAuthentication no to PasswordAuthentication yes
  22.  
  23. 6. Restart ssh:
  24.  
  25. sudo /etc/init.d/ssh restart
  26. Logout of your instance (exit) and try your new login without the .pem file:
  27.  
  28. $ ssh USERNAME@ec2-________.compute-1.amazonaws.com
  29. USERNAME@ec2-________.compute-1.amazonaws.com's password:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement