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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content