Kamran Agayev's Oracle Blog

Oracle Certified Master

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/

3 Responses to “Using scp with nohup command without providing password”

  1. Laurent Schneider Says:

    Why do not you use screen? Sounds more robust than CTRL-Z regarding session termination

  2. Shahzad Says:

    This is really helpful.
    Thanks brother.

  3. Log Buffer #300, A Carnival of the Vanities for DBAs | The Pythian Blog Says:

    [...] Kamran Agayev is using scp with nohup command without providing password. [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>