sftp chroot and ForceCommand to internal-sftp leads to an error on sftp-server: No such file or directory

Solution Verified - Updated -

Issue

With the below configuration in /etc/ssh/sshd_config:

...
Subsystem       sftp    /usr/libexec/openssh/sftp-server
...
Match User test
  ChrootDirectory /chroot
  ForceCommand internal-sftp

the server exits with

sshd[31754]: error: subsystem: cannot stat /usr/libexec/openssh/sftp-server: No such file or directory
subsystem request for sftp failed, subsystem not found

because the sftp-server file is not available in the chroot environment.

  • On the client side, we have this message:
sftp test@localhost
Connecting to localhost...
test@localhost's password: 
subsystem request failed on channel 0
Couldn't read packet: Connection reset by peer

Environment

RHEL 6
openssh-5.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.