Showing posts with label mac os. Show all posts
Showing posts with label mac os. Show all posts

Friday, October 26, 2018

How to configure ssh login with out password in Mac OS X and Linux


When ever we want to connect to remote server (or) host using SSH we will provide the host name after it prompt for password. If we follow the below step it won't ask for the password on each time.
ssh password less login


STEP 1 - Generating the key pair

Create your set of keys:
Start up the Terminal application and run:
ssh-keygen -t rsa -b 4096



STEP2 - Copy Generated public to our remote server


Copy the newly created public key to the SSH server(s) you need to auto login into by using your favourite transport method.

Please be careful not to overwrite ~/.ssh/authorized_keys if it already exist! This is how I personally copy the key, might not be your preferred method:

If authorized_keys exist:
cat ~/.ssh/id_rsa.pub | ssh username@example.com "cat - >> ~/.ssh/authorized_keys"
If authorized_keys does not exist:
scp ~/.ssh/id_rsa.pub username@example.com:~/.ssh/authorized_keys


Check your file permissions. A lot of different *nix system is picky when it comes to permissons. Setting your .ssh directory to 0700 and .ssh/authorized_keys to 0600.

  chmod 0700 ~/.ssh
  chmod 0600 ~/.ssh/authorized_keys