Using scp with nohup command without providing password
Posted by Kamran Agayev A. on December 1st, 2012
It seems almost impossible for me to use scp from command line with nohup and without providing password. I didn’t want to share authentication keys between servers using ssh-keygen, which seemed to be the only solution to run scp command in the background
I tried:
nohup scp -P 223 /tmp/myfile.dat user:pass@server:/tmp &
and failed. Using password in such way was incorrect syntax. Then I tried:
nohup scp -P 223 /tmp/myfile.dat user@server:/tmp &
it asked me for the password:
oracle@server’s password:
oracle
[1]+ Stopped nohup scp -P 223 /tmp/myfile.dat user@server:/tmp &
and failed again…
After making a little research, I found the following blog post, where the author shows how scp can be used in the command line by providing password and running the command in the background
http://bharatikunal.wordpress.com/2010/10/20/scp-as-a-background-process/
December 1st, 2012 at 10:37 pm
Why do not you use screen? Sounds more robust than CTRL-Z regarding session termination
December 2nd, 2012 at 12:30 pm
This is really helpful.
Thanks brother.
December 21st, 2012 at 5:35 am
[…] Kamran Agayev is using scp with nohup command without providing password. […]