Step 1: New Account setup
Optional: Add the user to Sudoers
Step 2: Generate the Public/Private key files
Now we will create the public and private key files for NewUser
Step 3: Download or copy private key
You will now have to download, or copy the contents of your private pem file. This should be called NewUser.pem.
If you are going to copy the contents of the file to a key file on your local system, just copy and paste the data into a new file.
*Note there were two keys made "Newuser" and "Newuser.pub". We have to copy the content of "Newuser" at Newuser.pem file at local machine.
'''Before using your key, make sure to change the permissions to 600.'''
Step 4: Test your SSH Login
That should do it! Hope you find this tutorial helpful.
Code:
adduser NewUser passwd NewUser
Code:
visudo #add this to the last line NewUser ALL = (ALL) ALL
Now we will create the public and private key files for NewUser
Code:
su - NewUser #Enter the password is ask cd ~/ ssh-keygen -b 1024 -f NewUser -t dsa mkdir .ssh chmod 700 .ssh cat NewUser.pub >> .ssh/authorized_keys chmod 600 .ssh/authorized_keys chown NewUser .ssh chown NewUser .ssh/authorized_keys
You will now have to download, or copy the contents of your private pem file. This should be called NewUser.pem.
If you are going to copy the contents of the file to a key file on your local system, just copy and paste the data into a new file.
Code:
vi Newuser.pem #copy the data from Newuser and paste here
'''Before using your key, make sure to change the permissions to 600.'''
Code:
chmod 600 NewUser.pem
Step 4: Test your SSH Login
Code:
ssh -i /path/to/file/NewUser.pem NewUser@YourDomain.com