Showing posts with label New User. Show all posts
Showing posts with label New User. Show all posts

Thursday, December 15, 2011

Add a new user to Amazon EC2 instance

After connecting to your Amazon EC2 instance, you can add a new user with sudo privilege with following steps:
  1. Open a putty session, log in with the default user, ec2-user
  2. sudo su
  3. useradd new_user_name
  4. passwd new_user_name, give a password for the new user
  5. vim /etc/sudoers, insert line "new_user_name ALL = NOPASSWD: ALL" at the end of the file
  6. cd /home/new_user_name
  7. mkdir .ssh
  8. cp ../ec2-user/.ssh/authorized_keys .ssh/authorized_keys
  9. chown -R new_user_name:new_user_name .ssh
  10. chmod 700 .ssh
  11. chmod 600 .ssh/*
Open another putty session and log in with the same private key you use for ec2-user.