Tag Info

Hot answers tagged

59

I don't know why sftp does this but you can only recursive copy if the destination directory already exists. So do this... sftp> mkdir bin sftp> put -r bin


28

Rsync is very well suited for transferring large files over ssh because it is able to continue transfers that were interrupted due to some reason. Since it uses hash functions to detect equal file blocks the continue feature is quite robust. It is kind of surprising that your sftp/scp versions does not seem to support large files - even with 32 Bit ...


26

The SSH protocol is defined by what the ssh and sshd programs accept. (There is a standard defined for it, but it's an after-the-fact thing and is mostly ignored when one of the implementations adds new features.) Since there are multiple implementations of those (OpenSSH, F-Secure, PuTTY, etc.) occasionally you'll find that one of them doesn't support the ...


21

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


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


17

I'm not sure about the file size limits of SCP and SFTP, but you might try working around the problem with split: split -b 1G matlab.iso This will create 1 GiB files which, by default, are named as xaa, xab, xac, .... You could then use scp to transfer the files: scp xa* xxx@xxx: Then on the remote system recreate the originial file with cat: cat xa* ...


14

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


13

Pass the user name through the -o User option, or through the equivalent User directive in the client configuration file (~/.ssh/config). sftp -o Port:8777 -o User=user@domain.com domain.com This applies to ssh, scp and sshfs as well. Using the configuration file instead of -o options has the advantage of also working with tools that call ssh and don't ...


11

You might be interested in using rsync instead. The command for that would be rsync --delete --rsh=ssh -av bin/ remote-ip-or-fqdn:/home/earlz/blah/bin/ This will copy everything in bin/ and place it in on the remote server in /home/earlz/blah/bin/. As an added benefit, it will first check to see if the file on the remote side hasn't changed, and if it ...


10

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


10

$ inotifywait -m /tmp Setting up watches. Watches established. /tmp/ CREATE file.ext.filepart /tmp/ OPEN file.ext.filepart /tmp/ MODIFY file.ext.filepart /tmp/ CLOSE_WRITE,CLOSE file.ext.filepart /tmp/ CREATE file.ext /tmp/ DELETE file.ext.filepart Transcript from running $ echo hello >/tmp/file.ext.filepart $ ln /tmp/file.ext.filepart /tmp/file.ext ...


9

SSH (stands for "Secure SHell") is a network protocol which described in RFC4251. ssh utility is SSH client that connects to SSH daemon and presents "Secure SHell" to user. SFTP is FTP-like protocol which works over SSH connection. su command does not use ssh or sshd in any way, it just allows you to run processes with different privileges.


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

sftp, like cp and scp, requires that when you copy a folder (and its contents, obviously), you have to explicitly tell it you want to transfer the folder recursively with the -r option. So, add -r to the command.


8

Authentications that can continue: publickey The first instance of the “Authentications that can continue” message only lists public keys. So the server is set up not to accept any other authentication method such as passwords. If the server accepted passwords as well, you'd instead see: Authentications that can continue: publickey,password ...


8

SFTP is not FTP. It's the sftp subsystem of ssh, it's handled by the sshd daemon, not vsftpd or any FTP server. It's on the ssh TCP port (22), not the FTP port 21 (well FTP commands are on 21 while data connections are on arbitrary ports, and those multiple connections in FTP are one of the many reasons why SFTP is so much better than FTP). ss -lp sport = ...


8

You got the right return code, sftp session executed correctly so the return code is 0. You should use scp instead, it does not returns 0 if it fails to copy. You could do something like : file=file_pattern`date -d "last month" +%m%Y`.csv remote=USER@remote.server.com:/rsdir1/rsdir2/rsdir3/$file local=/rsdir1/rsdir2/rsdir3/$file if scp -q $remote ...


8

You probably have some non-printable characters on end of lines (eg. CRLF from Windows), run: cat -A scriptname on remote machine, it'll show you all characters in your script. Then, you can convert to unix-like format running dos2unix scriptname


7

You can use fish (files transferred over shell protocol). There are various client implementations, but none require any server support beyond regular SSH.


7

May I suggest a somewhat complicated answer, without zipping, but including tar? Here we go: tar -cf - ./bin | ssh target.org " ( cd /home/earlz/blah ; tar -xf - ) " This will pack the directory ./bin with tar (-cf:=create file), filename - (none, stdout) and pipe it through the ssh-command to target.org (which might as well be an IP) where the command ...


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

Put it simple: SFTP = SSH + SFTP-server on server SCP = SSH + `scp` on server side FISH = SSH + `dd` (and some other basic Unix utilities on the server side only)


7

Remove Read access. Read access on a directory means that you can see a listing of files within that directory. Execute (X) access means you can cd into the directory or traverse it Write access means that you are able to add or change items within the directory.


6

SSH is a protocol for secure communication over an insecure network. It allows for end to end encryption of all communication such that it cannot (feasibly) be intercepted and decrytped. ssh the utility is an implementation of the protocol. SFTP is a subsystem of ssh that uses the protocol for secure password and file transfer. su does not use the ssh ...


6

It looks like there's no option for this with the OpenSSH SFTP client. You could use the PuTTY psftp command line tool instead, as its put and mput commands accept a -r (recursive) flag. It's in the putty-tools package under Debian (and most likely Ubuntu). Alternately, Filezilla will do what you want, if you want to use a GUI.


6

From the here-string (<<<) syntax you used I guess your shell is bash, so you can also use string with backslash-escaped characters ($''): sftp -o PasswordAuthentication=no user@host <<< $'lcd /home\n cd /myhome\n get file' The portable alternative is here-document: sftp -o PasswordAuthentication=no user@host <<END lcd /home cd ...


6

There is no mv command in the interactive mode of sftp. Use rename instead. To learn which commands are available, check the man page man sftp or type help within sftp.


5

Take a look at the OpenSSH project. It has all the info you're looking for. Briefly, the SSH protocol permits the secure (encrypted) connection between two hosts. The ssh utility is a client program to log into a remote system using the SSH protocol, and it has a lot of other uses, too, like [reverse] tunneling/port forwarding/... sshd it's the server ...


5

My two cent suggestion: you could use PAM to do this. E.g. Use some pam module as pam-mysql to store some of your users in mysql and pam_require to avoid that mysql-stored users can access other than sftp service. Start looking here: Modules/Applications available or in progress...


5

Did you restart the sshd service after making the changes to /etc/ssh/sshd_config? sudo /etc/init.d/ssh restart Ensure the chroot directory for the sftp user (in this case /home/lenny) is owned by root, not the sftp user. chmod 755 is correct. Also, I would add the following two lines for additional security: Match User lenny ChrootDirectory ...



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