Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to copy a big file (about 30 Gb) in background via ssh. If I do it this way, and disconnect, it's copied well:

ssh server
# cp /file1 /file2 & >/dev/null 2>/dev/null ; disown;

But if I do this:

ssh server 'cp /file1 /file2 & >/dev/null 2>/dev/null ; disown;'

it waits until file copies. Why?

share|improve this question
up vote 4 down vote accepted

Try adding -f:

ssh -f server 'cp /file1 /file2 & >/dev/null 2>/dev/null ; disown;'

(Tested and works for me.)

From the man page:

-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm.

share|improve this answer
That's OK, but there is still one more problem - I can't async copy files via python-paramiko from my python code because it's behavior is like ssh binary without option '-f' – user59178 Dec 27 '11 at 22:50
@user59178 - As the original question doesn't mention anything about python, I'd suggest posting this as a new question - and probably at – ziesemer Dec 27 '11 at 22:51
Anyway thanks, your answer is very useful – user59178 Dec 27 '11 at 22:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.