SlideShare a Scribd company logo
PREPARED BY RAVI KUMAR LANKE Page 1
Copying files between linux machines using scp
and ssh without linux user passwords
PREPARED BY RAVI KUMAR LANKE Page 2
1. Setup ssh keys on both machines
To generate a public / private key pair :
$ ssh-keygen -t rsa
The above will generate 2 files, ~/.ssh/id_rsa (private key) and /home/ oracle /.ssh/id_rsa.pub (public key)
To setup the SSH keys for usage (one time task) : Copy the contents of /home/ oracle /.ssh/id_rsa.pub of source server and paste in a new line
of /home/ oracle /.ssh/authorized_keys of destination server
If /home/oracle/.ssh/authorized_keys doesn't exist, feel free to create it.
2. To copy files use the below command
change to destination directory in destination server and run the below command
$scp -i ~/.ssh/id_rsa oracle@source_server_hostname:/u01/oracle/backup/*.* .
Cron job :
make a shell script as below and save it as filescopy.sh:
#!/bin/sh
backup_dir="/home/oracle/ backup"
cd $backup_dir
scp -i ~/.ssh/id_rsa oracle@source_server_hostname:/home/oracle/backup/*.* .
Now run the cron job on the destination server with above script
$crontab -e
Enter the below line
*/2 * * * * /u01/filescopy.sh > /u01/backup.log 2>&1
save and exit
It will copy the files into the destination server for every 2 sec.
Ad

Recommended

Arcshell SSH Module Overview
Arcshell SSH Module Overview
Ethan Ray Post
 
Hadoop presentation
Hadoop presentation
MaggieZhang61
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
anandha ganesh
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
Peter Martin
 
Bower introduction
Bower introduction
Oleksii Prohonnyi
 
Container Security
Container Security
amouat
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
Yusuf Felly
 
Linux presentation
Linux presentation
Ajaigururaj R
 
Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
venkatakrishnan k
 
Red Hat Linux cheat sheet
Red Hat Linux cheat sheet
Rafael Montesinos Muñoz
 
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
I Goo Lee
 
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUX
Mr.AKHILESH KUMAR {Computer Lab Technician}
 
Osquery
Osquery
Animesh Roy
 
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
PROIDEA
 
Basics of-linux
Basics of-linux
Singsys Pte Ltd
 
Git it on (includes git hub)
Git it on (includes git hub)
Martin Bing
 
R brownbag seminar 2.2
R brownbag seminar 2.2
Muhammad Nabi Ahmad
 
Unix slideshare
Unix slideshare
Mohan Krishna Kona
 
3 level cert tomcat
3 level cert tomcat
Suraj Pratap
 
Shell programming
Shell programming
Moayad Moawiah
 
Apache
Apache
Mindtree
 
Unix_basics
Unix_basics
Alexander Polovinko
 
Sahul
Sahul
sahul azzez m.i
 
Using the command line on macOS
Using the command line on macOS
AdamFallon4
 
DSpace Manual for BALID Trainee
DSpace Manual for BALID Trainee
Nur Ahammad
 
Linux system admin useful commands
Linux system admin useful commands
ali98091
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
GauravRaikar3
 
Introduction_Docker_TWM_20150323
Introduction_Docker_TWM_20150323
CHIANG, CHIA-HO
 
Tallglass Presentation
Tallglass Presentation
Sheila Flournoy Collins
 
eerste verdieping presentatie tekening
eerste verdieping presentatie tekening
Bob-Willem van Hooft
 

More Related Content

What's hot (20)

Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
venkatakrishnan k
 
Red Hat Linux cheat sheet
Red Hat Linux cheat sheet
Rafael Montesinos Muñoz
 
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
I Goo Lee
 
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUX
Mr.AKHILESH KUMAR {Computer Lab Technician}
 
Osquery
Osquery
Animesh Roy
 
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
PROIDEA
 
Basics of-linux
Basics of-linux
Singsys Pte Ltd
 
Git it on (includes git hub)
Git it on (includes git hub)
Martin Bing
 
R brownbag seminar 2.2
R brownbag seminar 2.2
Muhammad Nabi Ahmad
 
Unix slideshare
Unix slideshare
Mohan Krishna Kona
 
3 level cert tomcat
3 level cert tomcat
Suraj Pratap
 
Shell programming
Shell programming
Moayad Moawiah
 
Apache
Apache
Mindtree
 
Unix_basics
Unix_basics
Alexander Polovinko
 
Sahul
Sahul
sahul azzez m.i
 
Using the command line on macOS
Using the command line on macOS
AdamFallon4
 
DSpace Manual for BALID Trainee
DSpace Manual for BALID Trainee
Nur Ahammad
 
Linux system admin useful commands
Linux system admin useful commands
ali98091
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
GauravRaikar3
 
Introduction_Docker_TWM_20150323
Introduction_Docker_TWM_20150323
CHIANG, CHIA-HO
 
Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
venkatakrishnan k
 
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
I Goo Lee
 
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
PROIDEA
 
Git it on (includes git hub)
Git it on (includes git hub)
Martin Bing
 
3 level cert tomcat
3 level cert tomcat
Suraj Pratap
 
Using the command line on macOS
Using the command line on macOS
AdamFallon4
 
DSpace Manual for BALID Trainee
DSpace Manual for BALID Trainee
Nur Ahammad
 
Linux system admin useful commands
Linux system admin useful commands
ali98091
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
GauravRaikar3
 
Introduction_Docker_TWM_20150323
Introduction_Docker_TWM_20150323
CHIANG, CHIA-HO
 

Viewers also liked (13)

Tallglass Presentation
Tallglass Presentation
Sheila Flournoy Collins
 
eerste verdieping presentatie tekening
eerste verdieping presentatie tekening
Bob-Willem van Hooft
 
Susan hollis cv resume july 2015
Susan hollis cv resume july 2015
Susan Hollis
 
SMF or MMF? Which Is the Right Choice for Data Center Cabling?
SMF or MMF? Which Is the Right Choice for Data Center Cabling?
Monica Geller
 
Universal Studios
Universal Studios
Alex Luchak
 
Photo work
Photo work
belinda_505
 
Office of the Gov Volunteer Recognition
Office of the Gov Volunteer Recognition
Vanessa Dixon
 
Existencialismo
Existencialismo
Marta Millán Sánchez
 
창의적 발상
창의적 발상
진선 박
 
Hyperion 11-1-2-3-installation-guide-on-linux
Hyperion 11-1-2-3-installation-guide-on-linux
Amit Sharma
 
Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server
Ravi Kumar Lanke
 
Installing and configuring oracle hyperion financial close management 11123
Installing and configuring oracle hyperion financial close management 11123
Ravi Kumar Lanke
 
eerste verdieping presentatie tekening
eerste verdieping presentatie tekening
Bob-Willem van Hooft
 
Susan hollis cv resume july 2015
Susan hollis cv resume july 2015
Susan Hollis
 
SMF or MMF? Which Is the Right Choice for Data Center Cabling?
SMF or MMF? Which Is the Right Choice for Data Center Cabling?
Monica Geller
 
Universal Studios
Universal Studios
Alex Luchak
 
Office of the Gov Volunteer Recognition
Office of the Gov Volunteer Recognition
Vanessa Dixon
 
창의적 발상
창의적 발상
진선 박
 
Hyperion 11-1-2-3-installation-guide-on-linux
Hyperion 11-1-2-3-installation-guide-on-linux
Amit Sharma
 
Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server
Ravi Kumar Lanke
 
Installing and configuring oracle hyperion financial close management 11123
Installing and configuring oracle hyperion financial close management 11123
Ravi Kumar Lanke
 
Ad

Similar to Copying files between linux machines using scp and ssh without linux user passwords (20)

Introduction to SSH
Introduction to SSH
Hemant Shah
 
Ssh between ansible control node with that of target
Ssh between ansible control node with that of target
Narendranath Panda
 
SSH how to 2011
SSH how to 2011
Chris Hales
 
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Nag Arvind Gudiseva
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
Mandi Walls
 
Linux basic for CADD biologist
Linux basic for CADD biologist
Ajay Murali
 
An introduction to SSH
An introduction to SSH
nussbauml
 
SSH.pdf
SSH.pdf
AnisSalhi3
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
karlhennesey
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018
Mandi Walls
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
Jun Hong Kim
 
allscripts.pdf-----schedule.sh------ #!binbash #ssh .docx
allscripts.pdf-----schedule.sh------ #!binbash #ssh .docx
galerussel59292
 
2009 cluster user training
2009 cluster user training
Chris Dwan
 
Hadoop on osx
Hadoop on osx
Devopam Mittra
 
Apache Web Server Setup 2
Apache Web Server Setup 2
Information Technology
 
Ansible as configuration management tool for devops
Ansible as configuration management tool for devops
Puneet Kumar Bhatia (MBA, ITIL V3 Certified)
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
Drupal from scratch
Drupal from scratch
Rovic Honrado
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsync
Hazel Smith
 
Clustering manual
Clustering manual
Md. Mahedi Mahfuj
 
Introduction to SSH
Introduction to SSH
Hemant Shah
 
Ssh between ansible control node with that of target
Ssh between ansible control node with that of target
Narendranath Panda
 
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Nag Arvind Gudiseva
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
Mandi Walls
 
Linux basic for CADD biologist
Linux basic for CADD biologist
Ajay Murali
 
An introduction to SSH
An introduction to SSH
nussbauml
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
karlhennesey
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018
Mandi Walls
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
Jun Hong Kim
 
allscripts.pdf-----schedule.sh------ #!binbash #ssh .docx
allscripts.pdf-----schedule.sh------ #!binbash #ssh .docx
galerussel59292
 
2009 cluster user training
2009 cluster user training
Chris Dwan
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsync
Hazel Smith
 
Ad

More from Ravi Kumar Lanke (20)

Steps for Multimedia Signal Processesing.ppt
Steps for Multimedia Signal Processesing.ppt
Ravi Kumar Lanke
 
An overview of concepts of Sentiment Analysis
An overview of concepts of Sentiment Analysis
Ravi Kumar Lanke
 
Step by Step Oracle Virtual Manager Installation.ppt
Step by Step Oracle Virtual Manager Installation.ppt
Ravi Kumar Lanke
 
CA workload Automation Tool Power Point Presentation
CA workload Automation Tool Power Point Presentation
Ravi Kumar Lanke
 
Creating and configuring vnc sessions
Creating and configuring vnc sessions
Ravi Kumar Lanke
 
Exporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle database
Ravi Kumar Lanke
 
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Ravi Kumar Lanke
 
Enabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bit
Ravi Kumar Lanke
 
Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...
Ravi Kumar Lanke
 
Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7
Ravi Kumar Lanke
 
How to find ip and mac address
How to find ip and mac address
Ravi Kumar Lanke
 
Step by step deployment of sampleappv406
Step by step deployment of sampleappv406
Ravi Kumar Lanke
 
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Ravi Kumar Lanke
 
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Ravi Kumar Lanke
 
Installing my sql on windows
Installing my sql on windows
Ravi Kumar Lanke
 
How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...
Ravi Kumar Lanke
 
How to disable and enable task manager
How to disable and enable task manager
Ravi Kumar Lanke
 
Deploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame works
Ravi Kumar Lanke
 
Installing oracle endeca commerce
Installing oracle endeca commerce
Ravi Kumar Lanke
 
How to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise manger
Ravi Kumar Lanke
 
Steps for Multimedia Signal Processesing.ppt
Steps for Multimedia Signal Processesing.ppt
Ravi Kumar Lanke
 
An overview of concepts of Sentiment Analysis
An overview of concepts of Sentiment Analysis
Ravi Kumar Lanke
 
Step by Step Oracle Virtual Manager Installation.ppt
Step by Step Oracle Virtual Manager Installation.ppt
Ravi Kumar Lanke
 
CA workload Automation Tool Power Point Presentation
CA workload Automation Tool Power Point Presentation
Ravi Kumar Lanke
 
Creating and configuring vnc sessions
Creating and configuring vnc sessions
Ravi Kumar Lanke
 
Exporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle database
Ravi Kumar Lanke
 
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Ravi Kumar Lanke
 
Enabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bit
Ravi Kumar Lanke
 
Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...
Ravi Kumar Lanke
 
Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7
Ravi Kumar Lanke
 
How to find ip and mac address
How to find ip and mac address
Ravi Kumar Lanke
 
Step by step deployment of sampleappv406
Step by step deployment of sampleappv406
Ravi Kumar Lanke
 
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Ravi Kumar Lanke
 
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Ravi Kumar Lanke
 
Installing my sql on windows
Installing my sql on windows
Ravi Kumar Lanke
 
How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...
Ravi Kumar Lanke
 
How to disable and enable task manager
How to disable and enable task manager
Ravi Kumar Lanke
 
Deploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame works
Ravi Kumar Lanke
 
Installing oracle endeca commerce
Installing oracle endeca commerce
Ravi Kumar Lanke
 
How to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise manger
Ravi Kumar Lanke
 

Recently uploaded (20)

Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
RAKESH SAJJAN
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
ICT-8-Module-REVISED-K-10-CURRICULUM.pdf
ICT-8-Module-REVISED-K-10-CURRICULUM.pdf
penafloridaarlyn
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
RAKESH SAJJAN
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
ICT-8-Module-REVISED-K-10-CURRICULUM.pdf
ICT-8-Module-REVISED-K-10-CURRICULUM.pdf
penafloridaarlyn
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 

Copying files between linux machines using scp and ssh without linux user passwords

  • 1. PREPARED BY RAVI KUMAR LANKE Page 1 Copying files between linux machines using scp and ssh without linux user passwords
  • 2. PREPARED BY RAVI KUMAR LANKE Page 2 1. Setup ssh keys on both machines To generate a public / private key pair : $ ssh-keygen -t rsa The above will generate 2 files, ~/.ssh/id_rsa (private key) and /home/ oracle /.ssh/id_rsa.pub (public key) To setup the SSH keys for usage (one time task) : Copy the contents of /home/ oracle /.ssh/id_rsa.pub of source server and paste in a new line of /home/ oracle /.ssh/authorized_keys of destination server If /home/oracle/.ssh/authorized_keys doesn't exist, feel free to create it. 2. To copy files use the below command change to destination directory in destination server and run the below command $scp -i ~/.ssh/id_rsa oracle@source_server_hostname:/u01/oracle/backup/*.* . Cron job : make a shell script as below and save it as filescopy.sh: #!/bin/sh backup_dir="/home/oracle/ backup" cd $backup_dir scp -i ~/.ssh/id_rsa oracle@source_server_hostname:/home/oracle/backup/*.* . Now run the cron job on the destination server with above script $crontab -e Enter the below line */2 * * * * /u01/filescopy.sh > /u01/backup.log 2>&1 save and exit It will copy the files into the destination server for every 2 sec.