Tag Info

New answers tagged

0

Their was no exact follow up to how to do this with SCP, since that was what the original question was asking. sudo find /files/ -type f -exec chmod a-w {} \; scp -r username@server.com:/file/location/* /files When it's done copying the files change the permissions back sudo chmod a+w -R /files


2

The reason for this is that one of the login scripts on the target server is using stty... to set up terminal characteristics. The command fails when it doesn't have a tty, ie when you connect with scp. The solution is to protect the stty so that it runs only when an interactive session is present. There are a number of ways to do this; here are some ...


0

if you want to stay stick with scp for any reason, you might remove w permissions on your local data (if you have the right to do it) and scp won't touch it. To be more precise: 1. chmod a-w local/.tar.gz (in your local dir) 2. scp remote/.tar.gz local This is not very efficient, nice but might help if you need a fast temporal solution without changing to ...


1

I need advice/best practice on how I can avoid keying in passphrase when I add this crontab to run everyday. Create a new ssh key with an empty password, specially for this task. Save it in a file, say, ~/.ssh/cron. Add its corresponding public key to ~/.ssh/authorized_keys on the remote machine. When you run your scp from cron(8) do it with the new ...


2

Get error code first (stderr might be useful too.. Who makes script w/o logging errors...?). It's possible that either 'su' or 'scp' returned retVal>0. A snip from SCP source code for OSX: // I'd put my bet for this case.. void lostconn(signo) int signo; { if (!iamremote) fprintf(stderr, "lost connection\n"); exit(1); } Make ...


3

I did an strace on an scp of a file. It looks to me like scp does not use a temporary file name like wget does, it actually checks for the existence of the destination file, and opens it with O_WRONLY|O_CREAT. The destination file should exist if scp gets far to actually have data to write out. There's no way a "race" between destination file existence ...


2

You have two requirements here (files from filelist and remove source files) that scream for using rsync. Depending on what your filelist contains (relative or absolute paths, preserve paths on backup, etc) you could just do: rsync --files-from=filelist.txt --remove-source-files -avz \ . user@remotehost:/path/to/backup/folder


0

If I understand correctly, you have a file tat contains file names and you want to copy each of those files to the remote server and delete the local one if the copy was successful. If so, you can do: while read file; do scp "$file" user@remote.com:/remote/path && rm "$file" done < files.txt


2

rsync -av --files-from=/location/file.txt / user@server:/location/ That will copy the local file /location1/file2.abc to /location//location1/file2.abc etc. As rsync will invoke ssh only once, you only have to enter the password once. You may want to investigate using ssh keys though.


1

As stated by jas, scp -r localDir user@server:remoteDir should do a recursive copy. If you worry about timestamps of your files, that add the -p flag and they are also kept as on you local server (else they will be changed to the time of copy). This is fine with small volumes of data. If you have to regularly do this on large volumes (large number of ...


0

I can't tell if this is everything in the structure or just a component. If this is everything, you can do something like scp -r /doc remote:/doc_copy. If this is only a subset, then it's more difficult to do it all in scp. Some options might be to scp them one at a time, or use something like rsync (and its more expressive include/exclude interface).


3

Always refer to the manual for your distribution as the available arguments & options vary. Use man scp. As for a recursive copy in OSX using SCP the following should work: scp -r /local/directory username@server.example:/remote/directory


0

Assuming your shell is Bash, you can do it like this: ssh user@hostname.com "cat -f /path/to/file"


2

If your OS supports FUSE, you can use SSHFS to mount a remote directory to a local one. Otherwise, assuming your shell is bash, you can still do it like this: program <(ssh b 'cat /path/to/file') But this only works if your program only wants to read from the file on machine b.



Top 50 recent answers are included