Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    SCP as a background process

    I need to transfer 420GBs of files from one machine to another. I don't have physical access to either, so I'm using Putty to get this done from a windows box. The command I'm doing it with is

    scp -r dir
    But if I close the putty window (as I obviously can't be bothered to keep it on whilst 420GBs transfer as that's gonna take a few days), the transfer stops.

    I tried to run it as a background process (adding an &), but it just won't do that, as it's requesting a password. I tried to run it without requesting a password (with -B), but then it just spits out "permission denied".

    Any help?

  2. #2
    screen is your friend here...

    If it's not already installed, install it on the computer you putty into.

    Then run screen BEFORE the scp command. This will effectively clear the screen for you. From here, setup the scp command running, then press:

    then press D. this will "detatch" the screen session.. It's still running, but not on the screen. You can then logout of putty, and continue as normal, and also at any time, you can log back into the computer through putty, and check the progress. You can do "screen -r" to reconnect the detatched session, then ctrl+a then D again to detatch it again.

    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Cedar Falls/Iowa/USA

    use nohup

    The issue here is, when you start SCP or any command, your shell becomes the parent of the new process and its controlling terminal. Once you exit the shell, the controlling terminal dissappears and that kills the child process. So you need to have the process detach from the terminal and run as a background process. The command to do this is nohup. You may also want to send SCP's stdout and stderr to a file:

    nohup scp <params> & >nohup.out 2>&1

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts