Benches macOS

4

using scp to copy files from remote serve…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi am a new poster to this forum and getting (re)acquainted with the unix world using terminal on the Mac. I am part of webteam for a large website run by a nonprofit where I have administrative access. I hope that this forum is the correct venue for my question.

The other day I used terminal tsch to logg onto a remote server where I have admin privaleges. One of the other admins and I were in the process of experimenting with using either rsync or scp to "backup" the server. We are experimenting with different backup strategies over and above those supplied by our web host. After finding out how to open port 22 on my modem and setting services in sharing to allow for remote log on, I logged on to the remote server and ran this command (suggested by another admin):

scp -r -p -v /remotefolder [email protected]:/Users/drktyler/Documents/serverBU/

Unfortunately I had severely underestimated the amount of time it would take to perform scp and needed to terminate the scp job. For example, I only got 100 MB onto my Mac in one hour (normally takes about 6 mintues to download a 100 MB file from the internet) I tried to kill the job by doing:

ctrl -z

ls ps

kill (scp pid #)

This did not work. And I forgot about trying ctrl-c <blush>

I was able to exit my session on the remote server which "exited" the scp job.

Oh, before running scp, I did try rsync and it did not work. Unfortunately, I had not set my terminal session to an unlimited buffer size, so the early part of my session rolled off the terminal screen. This means I have no idea what the error was.

This morning the other admin was performing some backups on the remote server and noticed that there was a an unexplained directory on the remote server named:

mymacuserid

It had what he called some rpms. I am not exactly sure what a rpms cache files are, but I think that rpms has some relatationship to the RPM package manager used by many linux systems. I could not account for how the mymacuserid directory got on the remote server because I did not put it there and my log in id to the remote server bears no resemblance to my Mac user id.

We don't believe that this directory did any harm to the remote server, but I sure as heck would like to know how it got there.

My question is if there was something about my scp command that

(1) created this "temporary" mymacuserid directory on the remote server

(2) did the way I ended the scp job by exiting the terminal mean that this temporary directory was not "cleaned up."?

(3) what other options might have been available to me to kill the job and clean up after the job? ctrl-c while logged onto the remote server? opening up a second terminal window and killing the ssh job?

(4) is scp normally that slow?

My Mac: Mac Mini, 1.66 GHz Intel Core Duo, Memory: 1.5 GB 667 MHz DDR2 SDRAM, Mac OS 10.4.8

Remote server: CPU AuthenticAMD, AMD Athlon(TM) XP 2600+

Version psa v8.1.1_build81070716.12 os_CentOS 4.2

OS Linux 2.6.9-55.0.2.EL {CentOS is built from Red Hat Enterprise Linux}

Respectfully yours,

treehugger from nj

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    j.v.

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I usually get about 80% of my advertised DSL speed with scp. I can only suspect that there was some serious network congestion going on somewhere along the path, or otherwise crappy connection resulting in packet loss/retransmissions.

    I use
    rsync -vvzSauEe 'ssh -p 22' --delete --progress --stats "remote domain name:/full/path/to/source directory/" '/full/path/to/local destination' all the time with no problem, as well as the appropriately modified version to rsync in the reverse (upload) direction, to tunnel rsync through ssh. See man rsync to see what all the options do.

    You are aware, I assume, that if the remote pathname has white space in it, you need to quote the whole path and escape any white space with preceding backslashes, as I have shown in the above rsync example, right? Same holds true for remote pathname for scp. Single tick quotes enclosing pathnames with white space works fine for the local side, as does no quotes but escaped white space.

    Issuing a ctrl-c at the local computer should have killed your scp and I am not aware of rogue elements being left on the remote computer when doing so. Maybe ⌘q-ing Terminal in the middle of an active scp did it.

  2. 0

    Cole Tierney

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hello,

    Maybe you could try -o '-C' to enable compression? Or maybe it's -oC. Not sure about the syntax, but the -o option is suppose to let you specify ssh options that are not available in scp.

    Edit: Actually it -o seems to be used to specify ssh_config options, so maybe

    -o 'Compression yes' would help.

    --

    Cole

    Message was edited by: Cole Tierney

  3. 0

    njtreehugger

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    J.V. Thanks so much for your very helpful response!

    The other admin who was trying scp over the weekend also reported that the job ran very slowly, so I suspect the slow response time may be on the remote server end. I do appreciate knowing that you have gotten 80% of your advertised DSL speed with scp.

    Thank-you for being so polite and gentle in your response. 🙂 No I did not know that if the remote patname has white space in it, that I need to quote the whole path and escape any white space with preceding backslashes as you showed in your rsync example.

    Finally, as for the rogue elements being left on the server, I figured out that these rogue elements were left on the server the day before I did the aborted scp job because I had to quit the terminal in the middle of an active rsync job while logged onto the remote terminal. When I went onto the server this morning, I checked the timestamps on the rogue files and the timestamps match up.

    The other admin has finally succeeded in doing a full server back-up (in addition to the back-up using the back-up utility provided by our web host). So, for the moment we are in pretty good shape. Of course, I'm not sure that I could replicate what he did. <shrug>

    Thanks again. I'm glad I posted on this forum as I have always learned a lot by reading the apple forums I suspect that I will be posting again.

    T.H.

    P.S. Please forgive me for not including copies of your original message in my reply. There is probably a setting that I need to change. 🙂

  4. 0

    njtreehugger

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Dear Cole,

    Thanks for the suggestion about compression. Next time I have to try to scp (or rsync), I'll try it with compression.

    T.H.