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/