Skip to main content
Share Your Experience: Take the 2024 Developer Survey
36 votes

Is it possible to use rsync over sftp (without an ssh shell)?

An alternative to using rsync is to instead use lftp (which can connect to sftp) and use the mirror command. For example one can do lftp ~> open -u user,password sftp://host.com ~> mirror ...
xioxox's user avatar
  • 629
33 votes

Speed up SFTP uploads on high latency network?

With OpenSSH sftp client (which you seem to use), you can use: -R switch to increase request queue length (default is 64) -B switch to increase read/write request size (default is 32 KB) For a start,...
Martin Prikryl's user avatar
18 votes
Accepted

Chroot SFTP - Possible to allow user to write to current (chroot) directory

Hey @emmdee It took me forever to realize there is a simple and nice trick to that. You just have to make root the owner of a parent folder to where you wanna sFTP, then use force command to tell a ...
African Idiot's user avatar
17 votes
Accepted

Can connect via SSH - but not via SFTP? Exit status 127

It most probably means that the /usr/lib/openssh/sftp-server does not exist. Make sure the Subsystem directive points to an existing path: Subsystem sftp /usr/lib/openssh/sftp-server Or actually, ...
Martin Prikryl's user avatar
16 votes
Accepted

Enable password login for SFTP while keeping authentication by SSH keys

From what I gather you want to permit passwords from some users, but not others? You could setup a Match block. So your config might look something like below. ... PasswordAuthentication no ... ...
Zoredache's user avatar
  • 132k
15 votes

Is it possible to use rsync over sftp (without an ssh shell)?

Instead of Rsync, rclone supports syncing from/to and mounting SFTP network shares. Install rclone rclone config and follow the steps to add a new remote endpoint configuration. Input sftp at the ...
ominug's user avatar
  • 754
14 votes
Accepted

SFTP - whitelisting requests for read-only access

Oh, I just found the - apparently - best solution: The parameter -R sets the whole session into read-only mode. Match User my-read-user ChrootDirectory /sftp/%u ForceCommand internal-sftp -R
silent's user avatar
  • 432
14 votes

SFTP vs FTPS, and is an FTP server even required for SFTP?

The instance doesn't seem to have any kind of FTP server installed, and all incoming ports are blocked other than 22 and 443. Does this mean that an FTP server is not required for SFTP? SFTP; the SSH ...
HBruijn's user avatar
  • 80.7k
12 votes

SFTP Error - Couldn't read packet: Connection reset by peer

cat /var/log/auth.log May 10 17:08:32 machine sshd[31902]: fatal: bad ownership or modes for chroot directory component "/var/www/html/nextcloud/" that was my problem After we can follow this one ...
Sérgio's user avatar
  • 281
10 votes
Accepted

configure multiple sshd instances on debian 8 (jessie) systemd

The default Debian 8 systemd sshd unit is in /lib/systemd/system/ssh.service and is pretty simple. All you would need to do is something like cp /lib/systemd/system/ssh.service /etc/systemd/system/...
Zoredache's user avatar
  • 132k
10 votes
Accepted

Replace scp with sftp

Rsync over sftp or chroot sftp Edit: To be clear, the LFTP client supports numerous protocols, including FTP, HTTP, FISH, SFTP, HTTPS, FTPS and BitTorrent. In this example, we are using SFTP. The ...
Aaron's user avatar
  • 2,859
9 votes
Accepted

how to pipe data to sftp connection?

As this is the first result you find by googling for this question and it hasn't been mentioned already I'll add the solution I found here as well: you can use curls sftp implementation for this. As ...
bsod's user avatar
  • 106
7 votes

SFTP logging: is there a way?

In order to clearify the comments above: If you have sftp configured using a jail (chroot environment), you cannot log without additional configuration effort. The log cannot be written in the ...
Phil's user avatar
  • 223
7 votes
Accepted

Is there a client that combines SSH and SFTP?

There is nothing like "SSH commands". Those are shell commands. To an SSH terminal/client, the shell is just a black box with an input and an output. The client does not even understand that ...
Martin Prikryl's user avatar
7 votes
Accepted

ls -lt not working in SFTP

If the ls argument includes a mask (and the mask does not match a single folder only), all sorting flags are ignored. Note a lack of LS_*_SORT flags use in the do_globbed_ls function. Contrary to ...
Martin Prikryl's user avatar
7 votes
Accepted

Up-to-date alternatives of rssh or scponly

I recommend to just use the common chrooted internal-sftp that is included with most OpenSSH servers. SFTP clients are available on all operating systems so I do not see any problems with adoption. ...
Carlo Miguel Cruz's user avatar
7 votes
Accepted

SFTP asks for passphrase for unencrypted private key, but WinSCP works fine?

AFAIK sftp expect different format of key. The keys of OpenSSH should look like: -----BEGIN RSA PRIVATE KEY----- MIIEowIBAAKCAQEAyGhJBM7lcIZgvTbLG4S2N1oHAIszqAKKysCQY17Fp0dHvL+A ...
Romeo Ninov's user avatar
  • 5,957
7 votes
Accepted

Windows FTP over SSH

I know this is not the answer you want, but I strongly recommend switching to SFTP. First of all, SFTP is a different protocol, it's not just FTP over an SSH tunnel. So proxying ftp.exe over ssh.exe ...
Stuggi's user avatar
  • 3,576
7 votes

Error in libcrypto connecting RHEL 9 server to Centos 6 via SFTP/SSH

RHEL 9 defaults to stronger cryptographic ciphers and algorithms, breaking compatibility with legacy systems. Your options for the SSH daemon on the RHEL 9 system are: Switch the system-wide ...
HBruijn's user avatar
  • 80.7k
6 votes

How to put desired umask with SFTP?

In the ssh config file you can also use this to set the mode of the file specifically (overriding any chmod that the client may try to set). Here I am using internal-sftp but I guess it would be the ...
cloudranger's user avatar
6 votes
Accepted

How are files created during FTP?

Yes it probably does use mkdir(2) and open(2) (or something very similar). You could check by running strace(1) on your ftp daemon and exercising it e.g. strace -p <pid of ftp daemon>
user9517's user avatar
  • 116k
6 votes

Replace scp with sftp

You could use a batchfile aproximation: sftp -b batchfile [user@]host a batchfile includes a sequence of commands that must reproduce "scp" operation with equivalent ftp commands: cd ...
Roberto Paz's user avatar
6 votes

Can I use SFTP as SCP?

In the /etc/ssh/sshd_config change the SFTP subsystem type: Subsystem sftp internal-sftp This allows to perform all the filesystem operations without any shell. Then change the user's ...
Kondybas's user avatar
  • 7,044
6 votes

Chroot SFTP - Possible to allow user to write to current (chroot) directory

I know its been a couple of years, but this post got me 98% of the way there. after searching for a long time. To make it so that I can have users chrooted and automatically get them into their own ...
Joe's user avatar
  • 61
6 votes
Accepted

Linux Bash Script for detecting (and notifying by email) new SFTP connections to server

The nice thing about ssh subsystems is that you can replace the default implementation (internal-sftp as Martin remarked) with another implementation, e.g. a wrapper script around /usr/lib/openssh/...
Piotr P. Karwasz's user avatar
6 votes

Openssh - Allow root to access both sftp and ssh

The ForceCommand directive only allows root to use sftp, try commenting out that line.
Rob M's user avatar
  • 1,492
5 votes
Accepted

Delete files older than X days on remote server with SCP/SFTP

This question is very old but I still wanted to add my bash only solution as I was just searching for one when I came here. The grep tar in the listing command is just for my own purpose to list only ...
dirkaholic's user avatar
5 votes

Is it possible to use rsync over sftp (without an ssh shell)?

Option combining best of all It appears to have the following advantages that other answers here don't have: fully benefits from SSH (secure) fully benefits from rsync (bandwidth-efficient protocol, ...
Stéphane Gourichon's user avatar
5 votes

FTP v/s SFTP v/s FTPS

Any-one interested in some numbers here are my results from running some benchmarks on my local network. SMB 2.1 performance is about 112 MB/s Machine: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz/...
Chad's user avatar
  • 231
5 votes

How to disable SFTP for some users, but keep SSH enabled?

It is possible to enable SFTP globally, and disabling SFTP for only some users. This does not work if you want your user to get a regular shell prompt. Nor does it make sense, as you could circumvent ...
aude's user avatar
  • 201

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