Transfer Files between 2 Linux Machine without prompt for the Password
Server A [192.168.1.20]
Server B [192.168.1.21]
You want to automate it that shell script run at any time and move file from Server A to Server B with out prompting for the passwords.
-- Ping Server B from Server A and and Server A from Server B.
ping -t 192.168.1.21
64 bytes from 192.168.1.21 icmp_seq=1 ttl=64 time=0.246
Let suppose that Oracle user should be used to transfer files a folder in Server A to Server B
Login through Oracle User to Server A and run from below command :
Oracle] $ ssh-keygen -t rsa
Just press enter
It will generate 2 files in /home/oracle/.ssh directory:
id_rsa.pub
id_rsa
-- File id_rsa.pub are your public keys copy this file to Server B to location /home/oracle/.ssh
.ssh] $scp id_rsa.pub oracle@192.168.1.21:/home/oracle/.ssh
password: *********
--Now Goto Server 2
oracle] $ cd .ssh
.ssh] $ cat id_rsa.pub >>~/.ssh/authorized_keys
It will be appended to authorized keys file.
chmod 600 authorized_keys &
chmod -R 700 .ssh/
--Now move any file from Server A to Server B with prompting for passwords
scp any_directory/anyfiles oracle@serverB:/anydiretory
File will be copied without prompting for password.
Server A [192.168.1.20]
Server B [192.168.1.21]
You want to automate it that shell script run at any time and move file from Server A to Server B with out prompting for the passwords.
-- Ping Server B from Server A and and Server A from Server B.
ping -t 192.168.1.21
64 bytes from 192.168.1.21 icmp_seq=1 ttl=64 time=0.246
Let suppose that Oracle user should be used to transfer files a folder in Server A to Server B
Login through Oracle User to Server A and run from below command :
Oracle] $ ssh-keygen -t rsa
Just press enter
It will generate 2 files in /home/oracle/.ssh directory:
id_rsa.pub
id_rsa
-- File id_rsa.pub are your public keys copy this file to Server B to location /home/oracle/.ssh
.ssh] $scp id_rsa.pub oracle@192.168.1.21:/home/oracle/.ssh
password: *********
--Now Goto Server 2
oracle] $ cd .ssh
.ssh] $ cat id_rsa.pub >>~/.ssh/authorized_keys
It will be appended to authorized keys file.
chmod 600 authorized_keys &
chmod -R 700 .ssh/
--Now move any file from Server A to Server B with prompting for passwords
scp any_directory/anyfiles oracle@serverB:/anydiretory
File will be copied without prompting for password.
No comments:
Post a Comment