Tag Info

Hot answers tagged

26

You can set that user's shell to rssh or scponly, which are designed precisely for that purpose: rssh is a restricted shell for use with OpenSSH, allowing only scp and/or sftp. It now also includes support for rdist, rsync, and cvs. scponly is an alternative 'shell' (of sorts) for system administrators who would like to provide access to remote ...


18

SFTP isn't the FTP protocol over ssh, but an extension to the SSH protocol included in SSH2 (and some SSH1 implementations). SFTP is a file transfer protocol similar to FTP but uses the SSH protocol as the network protocol (and benefits from leaving SSH to handle the authentication and encryption). SCP is only for transferring files, and can't do other ...


16

You can use the advanced globbing patterns in some shells to match all the files in a directory except for those matching a particular pattern. For example, in ksh, bash or zsh, the command shopt -s extglob ## needed in bash only setopt ksh_glob ## needed in zsh only mv /source/!(*.bak) /destination will move all files in /source to /destination ...


15

SSH Supports chrooting an SFTP user natively. You just need to supply ChrootDirectory In your sshd config file, and restart sshd. If you are just doing sftp, then you don't have to do anything more. Unfortunately, this doesn't work for scp. For interactive shell, you will need to copy binaries, and /dev nodes into the chroot. An example config, for ...


15

scp provides a cp like method to copy files from one machine to a remote machine over a secure SSH connection. rsync allows you to syncronise remote folders. They are different programs and both have their uses. scp is always secure, whereas rsync must travel over SSH to be secure.


12

You can connect to the host using sftp -r and then get the directory. If you forget to use -r when you connect, you can use get -r. sftp -r me@somehost Or sftp> get -r tmp/ Fetching /home/me/tmp/ to tmp Retrieving /home/me/tmp /home/me/new.orig.dmp 100% 417KB 416.8KB/s 00:00 /home/me/untangle.dmp 100% 398KB 398.3KB/s 00:00 ...


12

A regular file is a file that isn't a directory or more exotic kinds of “special” files such as named pipes, devices, sockets, doors, etc. Symbolic links are not regular files either, but they behave like their target when it an application is accessing the content of the file. You passed root@IP: as the source of the copy and /path/to/picture.jpg as the ...


12

If you did not have the foresight to launch the process with nohup, you can also background the process and disown the bash session while it is running. Open ssh terminal to remote server Begin scp transfer as usual Background the scp process (Ctrl+Z, then bg) Disown the backgrounded process (disown) Terminate the session (exit) and the process will ...


11

You should quote your file name two times, one for the local shell and one for the remote one. In the simplest case you can do one of the following scp -r -P 8484 root@172.31.72.103:"'/media/New Volume/lj'" /home/pratheep scp -r -P 8484 root@172.31.72.103:'"/media/New Volume/lj"' /home/pratheep or using the help of tab completion scp -r -P 8484 ...


10

Tar with bzip2 compression should take as much load off the network and on the cpu. $ tar -C /path/to/src/dir -jcf - ./ | ssh user@server 'tar -C /path/to/dest/dir -jxf -' Not using -v because screen output might slow down the process. But if you want a verbose output use it on the local side of tar (-jcvf), not on the remote part. If you repeatedly copy ...


10

There are a few methods. The simplest way if you're just transferring a file once in a while. scp myfile.txt user@example.com:/home/user/ scp stands for secure copy and it transfers over SSH. There is also sftp sftp user@example.com > cd /home/user/ > put myfile.txt I guess the only real advantage to using this is that you can transfer multiple ...


10

pdcp from the pdsh package is one option. pdsh was written to help with management of HPC clusters - I've used it for that, and I've also used it for management of multiple non-clustered machines. pdsh and pdcp use genders to define hosts and groups of hosts (a "group" is any arbitrary tag you choose to assign to a host, and hosts can have as many tags as ...


9

There are many ways to do what you want. The simplest is to use a pìpe: tar zcvf - MyBackups | ssh user@server "cat > /path/to/backup/foo.tgz" Here, the compression is being handled by tar which calls gzip (z flag). You can also use compress (Z) and bzip (j). For 7z, do this: tar cf - MyBackups | 7za a -si -mx=9 -ms=on MyBackups.tar.7z | ssh ...


8

A chroot is a reasonably simple method. Since the operating system already has this security feature, daemon writers tend not to attempt to reimplement it. Rssh comes with a guide on setting up a chroot jail. It's in the CHROOT file in the source distribution. In a nutshell, you need to have: A few binaries, copied from the root: /usr/bin/scp, ...


8

FISH and SFTP are similar, and as observed do both work over SSH, SFTP requires specific support and configuration in the SSH Server to facilitate the transfer, but it a bit more secure and allows for SysAdmins to only allow SFTP (in these situations FISH won't work). FISH requires a shell (sh/rsh for instance) to copy, and hence requires full SSH access to ...


8

Ok LOL, I just figured out what the problem is. Since I like cows so much, I've put fortune | cowsay at the top of my .bashrc file which produces output like the following when starting bash: _______________________________________ < You will lose an important disk file. > --------------------------------------- \ ^__^ \ ...


8

You did't specify any file: you have to add the file (with path) after the colon A$ scp @hostB:/absolutepath/file . or A$ scp @hostB:relativepath/file . for a path relative to your home directory. If you don't specify a different user (i.e., the user on A and B are the same) you don't need the @ A$ scp hostB:/path/file .


8

As root, set up a named pipe: # mkfifo /tmp/fifo # chmod o+w /tmp/fifo Then, transfer your data as me: $ tar cfzp - foldertocopy | ssh me@machine "cat > /tmp/fifo" But read it as root: # tar -xfzp /tmp/fifo


8

In the sshd config man page man 5 sshd_config: MaxAuthTries Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged. The default is 6. So a setting of MaxAuthTries 2 will be the setting you will need. sshd will need to be ...


7

use rsync, it uses SSH. Usage: rsync -aPz /source/path destination.server:remote/path The rsync switches care about compression and I-Node information. -P displays progress of every file. You can use scp -C, which enables compression, but if possible, use rsync.


7

You might want to look at scponly; it's essentially a login shell that can only be used to launch scp or the sftpd subsystem. In the scponlyc variant it performs a chroot before activating the subsystem in question.


7

To open file using path relative to username's home directory run, vim scp://username@remotehost/file which is same as, vim scp://username@remotehost//home/username/file If you want to enter the absolute path to a file starting from / instead of your home directory, use two slashes after the host name run, vim ...


6

try this. should work with recent versions of xargs. svn st | awk '{print $2}' | xargs -iz scp z my_name@my_server: alternately, you could just loop though the files. for file in $(svn st | awk '{print $2}'); do scp $file my_name@my_server: ; done


6

A little diagnosis: from this debug1: Sending command: scp -v -r -p /PATH/TO/DIR root@SERVER2:/PATH/TO/DIR [...] debug1: read_passphrase: can't open /dev/tty: No such device or address I'd suspect (guess) it works this way, the server-to-server copy with scp logs into SERVER1 and executes the scp command to send the file to SERVER2; thus the caller (from ...


6

Your commands are trying to put the new Document to the root (/) of your machine. What you want to do is to transfer them to your home directory (since you have no permissions to write to /). If path to your home is something like /home/erez try the following: scp My_file.txt user_id@server:/home/erez/ You can substitute the path to your home directory ...


6

You could consider to use ssh connection sharing: Host *.some-domain ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%p You connect only once to your destination, and put the ssh process in background. Then you execute the other commands and you finally kill the first process. In alternative you can try to encapsulate a bunch of actions within one ...


6

The problem is that zsh is globbing the remote path. You can verify this by scp luna4:"/u/paige/maye/src/diviner/notebooks/plots/hk_*" . To turn globbing off for scp remote paths, but otherwise leave globbing the same (from here) add this to your .zshrc - # Disable globbing on the remote path. alias scp='noglob scp_wrap' function scp_wrap { local -a ...


5

There are many ways to skin this cat. Here are some for you to consider: The htdocs tree almost certainly doesn't have to be owned by root. What matters is that it be readable by the Apache user. Depending on the *ix system in question, that may be apache, www-data, or something else. The default file mode you give above, drwxr-xr-x (abbreviated 755) is ...


5

SSHFS allows you to mount a remote directory accessed over SSH, more precisely over SFTP. Once you've mounted the remote directory, use rsync on what are now local files. mkdir ~/cdn sshfs cdn.example.com: ~/cdn rsync -au ~/mystuff/dir/ ~/cdn/dir/



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