Step 1
Need to create a key file with following command
ssh-keygen -t rsa -b 2048 -f ssh-key-name
then copy the file that you want to access it with this key
scp -r ssh-key-name.pub root@192.168.1.50
Step 2
In remote machine we need to add this key to authorized_keys with below command
cat ssh-key-name >> .ssh/authorized_keys
if authorized_keys file or .ssh is not available then we have to create it manually.
goto the home directory of the user that you need to provide this access and create it.
mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
now add the key in authorized_keys
cat ssh-key-name > .ssh/authorized_keys
Step 3
Now we can access the remote server with following command
ssh -i ssh-key-name root@192.168.1.50
it will login to the remote server without using password.
Need to create a key file with following command
ssh-keygen -t rsa -b 2048 -f ssh-key-name
then copy the file that you want to access it with this key
scp -r ssh-key-name.pub root@192.168.1.50
Step 2
In remote machine we need to add this key to authorized_keys with below command
cat ssh-key-name >> .ssh/authorized_keys
if authorized_keys file or .ssh is not available then we have to create it manually.
goto the home directory of the user that you need to provide this access and create it.
mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
now add the key in authorized_keys
cat ssh-key-name > .ssh/authorized_keys
Step 3
Now we can access the remote server with following command
ssh -i ssh-key-name root@192.168.1.50
it will login to the remote server without using password.
No comments:
Post a Comment