Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i'm having trouble forcing users to only be able to use sftp when connecting over ssh.

I have the following lines in my /etc/ssh/sshd_config:

Subsystem sftp /usr/libexec/openssh/sftp-server

Match user USERNAME
ForceCommand internal-sftp

But when I try to connect via sftp, i get the error:

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

However, the file /usr/libexec/openssh/sftp-server does exist and seems to be working fine. If I don't try and force the connection to be sftp, then I can ssh in just fine, so the ssh daemon seems to be handling things correctly, but forcing sftp is not.

Does anyone have any suggestions? I've tried searching for answers but all the solutions i've found seem to be about the sftp-server not being in the correct place. For me though, the file is definitely there.

I'm using CentOS 6, and OpenSSH 5.3p1. Thanks for any help.

share|improve this question
    
Does SFTP work when the command isn't forced? –  mgorven Apr 23 '12 at 6:09
    
Yes, sftp works fine when it isn't forced. In that case i get the following message in my /var/log/secure when connecting via sftp: sshd[3569]: subsystem request for sftp –  Jai Redden Apr 23 '12 at 12:21

1 Answer 1

up vote 4 down vote accepted

Do you use "ChrootDirectory"? That would explain "file not found" if your "/usr/libexec/openssh/sftp-server" exist.

You should use "Subsystem sftp internal-sftp" instead (or give up on Chroot)

share|improve this answer
    
That should be Subsystem sftp internal-sftp –  xebeche Nov 17 '13 at 15:38
    
tnx @xebeche, I've edited it –  Matija Nalis Nov 17 '13 at 23:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.