I'm using Mac 10.9.5 and bash shell. In our environment, we have to go through a proxy (a CentOS machine) to SSH properly into a destination machine (another CentOS machine). What I would like to do is create a shortcut so that I can scp files quickly to the destination server, something like
scp localfile.txt davea@server:/home/davea
But right now, I have to do multiple commands to transfer the file …
scp localfile.txt davea@proxy:/home/davea
ssh davea@proxy
scp localfile.txt davea@server:/home/davea
Is it possible to condense the above into one line?
ssh davea@proxy(and then)scp localfile.txt davea@server:/home/davea, Dave meantssh davea@proxyand thenscp localfile.txt davea@server:/home/daveafrom the shell prompt on theproxyhost. Yourssh davea@proxy && scp $1 davea@server:/home/daveaisn't going to do that. Something likeecho "scp $1 davea@server:/home/davea" | ssh davea@proxymight work, but I doubt that it's optimal. – G-Man Says 'Reinstate Monica' Nov 21 '14 at 18:41