LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   error: subsystem: cannot stat /usr/libexec/openssh/sftp-server (https://www.linuxquestions.org/questions/red-hat-31/error-subsystem-cannot-stat-usr-libexec-openssh-sftp-server-4175453017/)

earwaxntoast 03-06-2013 04:41 PM

error: subsystem: cannot stat /usr/libexec/openssh/sftp-server
 
I have a RHEL 6.3 box running OpenSSH 5.3.
The box is set up as an SFTP server. I am using keypair and password authentication. When I attempt a connection, I always get the following error in /var/log/secure:

error: subsystem: cannot stat /usr/libexec/openssh/sftp-server: No such file or directory

I have verified that the file exists, and is executable by everyone.

I've also attempted moving the file to another location and updating my sshd_config file, and still got the error, but with the updated path.

I have updated OpenSSH to v5.3, and I'm still getting the same error.

When I attempt to connect from another linux box using the sftp command, I get the following error:
subsystem request failed on channel 0
Couldn't read packet: Connection reset by peer

However, if I attempt to connect using either Filezilla, or putty's psftp software, the connection is successful and I'm able to use the sftp server.

The file not found error on the subsystem file still occurs in the secure log, however.

Unfortunately, I can't just suggest another client in this case, since our client needs to script out automatic loads of a file via the command line sftp client.

I've searched google for hours and can only find folks who haven't verified file location, which was the first thing I checked.

Any assistance or guidance is very much appreciated!

Kustom42 03-06-2013 04:45 PM

What is the output of the following on the file?

Code:

lsattr
stat
ls -alZ


Also, is selinux enabled?

earwaxntoast 03-06-2013 04:53 PM

Thanks for taking the time to reply.

Here's the result of your commands. I also threw in a locate since it was the last thing I did before your stuff:
Code:

[root@pvm269 openssh]# locate sftp-server
/usr/libexec/openssh/sftp-server
/usr/share/man/man8/sftp-server.8.gz
[root@pvm269 openssh]# lsattr
-------------e- ./ssh-keycat
-------------e- ./sftp-server
-------------e- ./ssh-keysign
[root@pvm269 openssh]# stat
stat: missing operand
Try `stat --help' for more information.
[root@pvm269 openssh]# ls -alZ
drwxr-xr-x. root root unconfined_u:object_r:usr_t:s0  .
drwxr-xr-x. root root system_u:object_r:usr_t:s0      ..
-rwxr-xr-x. root root unconfined_u:object_r:usr_t:s0  sftp-server
-rwxr-xr-x. root root unconfined_u:object_r:usr_t:s0  ssh-keycat
-rwxr-xr-x. root root unconfined_u:object_r:usr_t:s0  ssh-keysign
[root@pvm269 openssh]#

selinux is enabled:

Code:

[root@pvm269 openssh]# sestatus
SELinux status:                enabled
SELinuxfs mount:                /selinux
Current mode:                  permissive
Mode from config file:          permissive
Policy version:                24
Policy from config file:        targeted
[root@pvm269 regentadmin]#


earwaxntoast 03-06-2013 04:57 PM

sorry, missed the stat:

Code:

[root@pvm269 openssh]# stat sftp-server
  File: `sftp-server'
  Size: 63544          Blocks: 128        IO Block: 4096  regular file
Device: fd00h/64768d    Inode: 787314      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)  Gid: (    0/    root)
Access: 2013-03-06 17:16:51.272038846 -0500
Modify: 2013-03-06 17:16:51.273039770 -0500
Change: 2013-03-06 17:16:51.273039770 -0500


chrism01 03-06-2013 07:00 PM

Hmmm; given you've got SELinux as Permissive (risky) it shouldn't affect things, but FYI on my Centos 6.3
Code:

ls -alZ
drwxr-xr-x. root root system_u:object_r:bin_t:s0      .
drwxr-xr-x. root root system_u:object_r:bin_t:s0      ..
-rwxr-xr-x. root root system_u:object_r:bin_t:s0      gnome-ssh-askpass
-rwxr-xr-x. root root system_u:object_r:bin_t:s0      sftp-server
lrwxrwxrwx. root root system_u:object_r:bin_t:s0      ssh-askpass -> gnome-ssh-askpass
-rwxr-xr-x. root root system_u:object_r:bin_t:s0      ssh-keycat
-rwsr-xr-x. root root system_u:object_r:ssh_keysign_exec_t:s0 ssh-keysign

You can manually set SELinux via chcon cmd, or use settings from Policy file via restorecon cmd.

earwaxntoast 03-07-2013 07:33 AM

Just to update this thread, the solution was:

# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server <---- comment this line out
Subsystem sftp internal-sftp <---- add this line

service sshd restart

Thanks to you two that took the time to reply.

ppiper 10-25-2013 05:15 AM

thx
 
Quote:

Originally Posted by earwaxntoast (Post 4906660)
Just to update this thread, the solution was:

# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server <---- comment this line out
Subsystem sftp internal-sftp <---- add this line

service sshd restart

Thanks to you two that took the time to reply.

cool, thx for the answer. An Update reset these settings and your solution saved me some more time to be wasted ^^


All times are GMT -5. The time now is 07:15 PM.