Announcement

Collapse
No announcement yet.

ssh login through key password instead

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ssh login through key password instead

    Step 1: New Account setup

    Code:
    adduser NewUser
     passwd NewUser
    Optional: Add the user to Sudoers


    Code:
    visudo
     #add this to the last line
     NewUser   ALL = (ALL)    ALL
    Step 2: Generate the Public/Private key files

    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
    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.

    Code:
    vi Newuser.pem
     #copy the data from Newuser and paste here
    *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.'''

    Code:
    chmod 600 NewUser.pem

    Step 4: Test your SSH Login



    Code:
    ssh -i /path/to/file/NewUser.pem NewUser@YourDomain.com
    That should do it! Hope you find this tutorial helpful.
Working...
X