I have a server with ‘root’ access but when I tried to SFTP in with the SSH Explorer client, it came up with a “subsystem request for sftp failed” error message. When trying to SFTP in, the SSH (/var/log/secure) logs came up with the following error:
sshd: subsystem request for sftp sshd: error: subsystem: cannot stat /usr/libexec/sftp-server: No such file or directory sshd: subsystem request for sftp failed, subsystem not found
A user can SFTP in only when SSH access is enabled for the user, in my case, I was using ‘root’ as user and was able to SSH in fine.
On further investigation, I found the ‘Subsystem’ parameter for sftp is defined in the SSH configuration file /etc/ssh/sshd_config.
# grep Subsystem /etc/ssh/sshd_config Subsystem sftp /usr/libexec/sftp-server
This indicates that SFTP is looking /usr/libexec/sftp-server file which is missing
# ls -la /usr/libexec/sftp-server /bin/ls: /usr/libexec/sftp-server: No such file or directory
The solution is to find the actual location of the ‘sftp-server file and
1) Creating a symlink to it in the /usr/libexec/ directory
2) Edit the SSH configuration file and specify the correct path to the ‘sftp-server’ file in the ‘Subsystem’ parameter.
Locate the sftp-server file:
# find / -name sftp-server /usr/libexec/openssh/sftp-server
and create a symlink to the actual file
# ln -s /usr/libexec/openssh/sftp-server /usr/libexec/sftp-server
Restart the SSHD service
# service sshd restart
You should be able to SFTP in successfully.