Tag Info

Hot answers tagged

49

In a nutshell, scp can only be used for transferring files, and it is non-interactive (i.e., everything has to be specified on the command line). sftp is more elaborate, and allows interactive commands to do things like creating directories, deleting directories and files (all subject to system permissions, of course), etc.


44

From Wikipedia: Compared to the earlier SCP protocol, which allows only file transfers, the SFTP protocol allows for a range of operations on remote files – it is more like a remote file system protocol. An SFTP client's extra capabilities compared to an SCP client include resuming interrupted transfers, directory listings, and remote ...


33

Something like this should work well: tar c some/dir | gzip - | ssh host2 tar xz Maybe also omit gzip and the "z" flag for extraction, since you are on a gigabit network.


33

The way the question is asked is pretty confusing, but if you can copy from your local machine to the server, to go the other way just flip the command line order. its scp [from] [to] scp user@homeip:/path/to/file /local/path/


27

First, you need to copy the file to a place where you have write access without sudo, scp yourfile serverb: Then move the file using sudo ssh serverb sudo mv yourfile /path/to/the/destination If you do not have a writable place, make a temporary dir with write permission for your user. ssh serverb sudo mkdir tempdir && sudo chmod 777 tempdir ...


27

In the past, the way in which scp worked, when called (naively) to copy files between remote systems, was very inconvenient: if you wrote for instance scp user1@remote1:/home/user1/file1.txt user2@remote2:/home/user2/file1.txt scp would first open an ssh session on remote1, and then it wouldrun scp from there to remote2. For this to work, you would ...


26

To send a file: cat file | ssh ajw@dogmatix "cat > remote" Or: ssh ajw@dogmatix "cat > remote" < file To receive a file: ssh ajw@dogmatix "cat remote" > copy


25

Rsync will obviously be faster than scp if the target already contains some of the source files, since rsync only copies the differences. But I suspect your question was about doing a straightforward copy to an empty target. You've passed the -z option to rsync; this turns on compression. If the network bandwidth is the limiting factor (it often is), ...


24

You can pipe into ssh and run a remote command. In this case, the remote command is cat > big.txt which will copy stdin into the big.txt file. echo "Lots of data" | ssh user@example.com 'cat > big.txt' It's easy and straightforward, as long as you can use ssh to connect to the remote end. You can also use nc (NetCat) to transfer the data. On the ...


20

You can also use inotifywait from the inotify-tools package. inotifywait -r -m -e close_write --format '%w%f' /tmp | while read MODFILE do echo need to rsync $MODFILE ... done


20

Pipes: A$ tar c thefile anotherfile | ssh B "ssh C \"cd destination && tar xv\"" (Sometimes tar cf - or tar cf /dev/stdout has to be used instead of tar c. Similar for the receiving end.) single-file: A$ cat < thefile | ssh B "ssh C \"cd destination && cat > thefile\"" Tunnel through B: A$ ssh -fN -L 4567:C:22 B (all TCP ...


19

I know this is a late answer, but I just found out a cool way to do this. It is basically Holger Just's answer, but in a saved config file: You need to put this in your ~/.ssh/config file on local.machine, (creating the file if it does not exist) Host target.machine User targetuser HostName target.machine ProxyCommand ssh ...


19

Copy the file "foobar.txt" from a remote host to the local host $ scp your_username@remotehost.edu:foobar.txt /some/local/directory Copy the file "foobar.txt" from the local host to a remote host $ scp foobar.txt your_username@remotehost.edu:/some/remote/directory Copy the directory "foo" from the local host to a remote host's directory "bar" $ scp -r ...


18

How about using rsync instead with the -z option enabled for compression? rsync -az --progress source_dir/* remote_host:/destination_dir This also has the added benefit that if the file already exists and has not changed on the destination, it will not be transferred.


18

Originally I recommended http://www.swish-sftp.org/. It adds an 'Other' Swish drive in which each folder is an SFTP connection however this can't be accessed in all applications such us Java based Eclipse IDE or Notepad++. An alternative that works is http://www.eldos.com/sftp-net-drive/ or even runing Apache WebDAV (over SSL) as windows can natively map ...


18

use 'tar' tar cvzf - -T list_of_filenames | ssh hostname tar xzf -


17

I don't think you can, but you could use rsync? Something like this: rsync -a --exclude=a/c myserver:/a .


17

The scp option -3 ought to be what you are looking for. To put it in your example: scp -3 root@firstcomputer:./file root@secondcomputer:./ Note that the -3 option was first introduced in OpenSSH 5.7, which was released early 2011.


17

FTPS is FTP using the SSL protocol for encryption. This is different from the SCP/SFTP family of protocols which use SSH as their transport tunnel. You will usually use the same client programs for scp and sftp (WinSCP for instance; SFTP is an upgraded version of SCP), whereas you usually use a web browser or web Download manager (like filezilla) for FTPS. ...


15

System Preferences pane → Sharing applet → check the Remote Login checkbox. This will enable SSH, and in turn, SCP.


14

Since you're trying to use scp I assume there is a an SSH server running on the remote machine. You can directly connect to ssh servers using Nautilus file manager. Just use something like ssh://username@server:/path/on/remote/machine in the address bar. Furthermore, if an SSH server is running you could also use the SFTP protocol for remote file ...


14

From the help text: "... [-F ssh_config] ..." According to the above, -F expects one argument: path to an OpenSSH configuration file, ~/.ssh/config or similar. But you are giving it a gzipped SQL dump instead. Since plain ssh myalias is already working, you don't even need the -F option here. Just sftp myalias would connect to the server. However, the ...


13

One possible cause of this type of behavior is having any message print out during the login process on server. Scp depends on ssh to provide a totally transparent encrypted tunnel between the client and the server. Check all of the login scripts on the server, and also try using a different user. Another method of identifying the source of the error is ...


13

You can use ssh and tar to work around this: ssh -t host 'sudo -v' ssh -C host 'cd /; sudo tar cf - path/to/file/or/dir' | tar xpsf - --preserve This first updates your sudo timestamp (asking for a password if necessary, which requires a tty (ssh -t)), and then uses sudo to create a tarball remotely and extract it locally. "tar" on RedHat 5 requires the ...


12

This would be a lot easier with SFTP, which is an extension to SSH that supports more complex file operations than SCP. Virtually all modern Unix and Linux distributions support it. To use it, just run this command to connect to the server: sftp server Then you can use the ls and cd commands to browse around and find the file you're looking for. Once ...


12

I'm sure the fact that you have all FIVE MILLION files in a single directory will throw many tools into a tizzy. I'm not surprised that rsync didn't handle this gracefully - it's quite a "unique" situation. If you could figure out a way to structure the files into some sort of directory structure, I'm sure the standard sync tools such as rsync would be ...


11

ExpanDrive. As of 2008 I'm not aware of any solution that supports SCP, but there is a nasty horrible evil hack which should work (install Linux in a virtual machine, install sshfs, make a samba share, mount that on the host Windows machine). You're probably better off just using WinSCP. EDIT: there is now also https://www.eldos.com/sftp-net-drive/


11

-i identity_file Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1). Use ~/.ssh/id_rsa.


11

PuTTY for shell access. WinSCP (UI, no cmd) for file transfers.


11

did you check that direct authentication works from first remote host to the second one? scp user@host:/file user@otherhost:/otherfile is shorthand for ssh user@host scp /file user@otherhost:/otherfile which leeds me to think: ssh -p XXX user@host scp -P XXX /file user@otherhost:/otherfile might work.



Only top voted, non community-wiki answers of a minimum length are eligible