troubleshooting Question

How to ssh to a local VM and copy a file?

Avatar of missymadi
missymadi asked on
LinuxShell Scripting
7 Comments2 Solutions411 ViewsLast Modified:
Experts,

      I have started a script to automate a tedious setup of our environment. I was wondering how to ssh into a VM and backup a file then replace with an updated file?

Thanks, Missymadi
#/bin/bash

#reroute traffic
route add -host 00.00.00.00 netmask 0.0.0.0 gw 0.0.0.0

#make backup file
cp /home/rc/file1 /home/rc/file1ORIG

#copy new file 
cp /home/rc/

#need to ssh into a local VM
ssh root@00.00.00.00

#reroute traffic
route add -host 00.00.00.00 netmask 0.0.0.0 gw 0.0.0.0

#make backup file
cp /home/rc/file1 /home/rc/file1ORIG

#copy new file 
cp /home/rc/
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros