Tag Info

Hot answers tagged

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.


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

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 ...


23

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/


21

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


19

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 ...


17

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


17

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 ...


16

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 ...


16

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.


16

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.


16

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 ...


15

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


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

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


14

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


14

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 ...


13

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. ...


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

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


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

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 ...


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.


11

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 ...


10

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 ...


10

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 ...


10

SftpDrive. 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.


10

I'm not to much skilled, but, instead of setting up a ssh server on windows, i suggest you to share a windows folder and then using samba, just copy the file to this shared folder. To a LAN a think this is a easier solution.


9

if you are rsyncing from a local machine to a remote host, this would work: rsync -avzl -e ssh /directory/with/files/ you@host.com:/new/directory/


9

Scp don't support sparse files. Use rsync instead. rsync -aS /home/myself/test/ myself@myserver:



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