Non Root user login through SSH in LINUX/CENTOS

SSH password less login between Linux machines as non root user , to enable password less login between two or more Linux / Centos machines as non root user.

SSH password less login is required for a variety of tasks like (backups , Hadoop cluster , scripting).

In our case we are using two Linux nodes as shown below.

Hosts

Linux 1: Test1

Linux 2: Test1

The IP address used for test1 and test 2 are as indicate below.

Test1:192.168.1.4

Test2: 192.168.1.11

Following steps will guide you to create two nodes communication over ssh channel using non-root user.

Step 1 :

i. Create user from the terminal of host 1(linux 1):

#useradd test1

#passwd test1

ii. LOGIN  from another terminal as non-root user account as you have created .i.e test1

Generate a pair of keys public and private by issuing below command

#ssh-keygen -t rsa

#ls –ali .ssh/

#ssh-copy-id test1@192.168.1.4

iii. To get authorized_keys, you have type the above command along with remote host IP    address.

To provide authentication to private key i.e. unseen by others

#cd .ssh/

#chmod 600 id_rsa.pub

#chmod 600 authorized_keys

iv. Also create user test 1 in linux 2 and follow the process again to provide authentications in host linux 2.

Step 2 :

i. Create user from the terminal of host 1 (linux 1):

#useradd test2

#passwd test2

ii.  LOGIN  from another terminal as non-root user account as you have created .i.e test 2

Generate pair of keys public and private by issuing below command

#ssh-keygen -t rsa

#ls –ali .ssh/

#ssh-copy-id test1@192.168.1.4

iii. To get authorized_keys, you have type the above command along with remote host IP

Provide authentication to private key i.e. unseen by others

#cd .ssh/

#chmod 600 id_rsa.pub

#chmod 600 authorized_keys

iv. Also create user test 2 in linux 2 and follow the process again to provide authentications in host linux 2.

Step 3 :

i. After you have configured all the procedure given above you can login to the remote host    through ssh by creating same user name in the linux 1 and linux 2 then follow the steps     to login to the remote host(linux 2) :

Check authorized_keys are available are not and then you can login through linux 1 to remote host linux 2 by the following commands:

#ssh-copy-id user@IP ADDRESS

#ssh-copy-id test1@192.168.1.11

#ssh test1@192.168.1.11

ii. After you have configured all the procedure given above you can login to the remote host     through ssh by creating same user name in the linux 1 and linux 2 then follow the steps    to login to the remote host (linux 2) :

Check authorized_keys are available are not and then you can login through linux 2 to remote host linux 1 by the following commands:

#ssh-copy-id user@IP ADDRESS

#ssh-copy-id test2@192.168.1.4

#ssh test2@192.168.1.4

For more details you can watch video and also subscribe for more Videos :

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk