Problem with sudo -s and SFTP

Advertisement

DaSilva
Joined:
Posts:
10
Location:
localhost

Problem with sudo -s and SFTP

I have followed the guide on https://winscp.net/eng/docs/faq_su and it works with my Debian Etch server as long as I log in with SCP but as soon as I want to use SFTP instead of SCP I cannot get su rights.
When I use SFTP only the "Default" SFTP server option works but then I miss the su rights. When I try to use "sudo /usr/bin/sftp" (where sftp is located from my OpenSSH installation) WinSCP says "Cannot initialize SFTP protocol. Is the host running a SFTP server?". I have tried several changes in the sshd_config but always the same problem.
Currently I have to use (slow) SCP if I want to have the su rights.
How can I get them as well with SFTP?
Thanks in advance.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Problem with sudo -s and SFTP

Have you checked log file of the SSH server?
_________________
Martin Prikryl

Reply with quote

DaSilva
Joined:
Posts:
10
Location:
localhost

Apr 20 12:32:10 s1 sshd[9356]: Accepted password for user from 12.34.56.78 port 63457 ssh2
Apr 20 12:32:10 s1 sshd[9358]: (pam_unix) session opened for user user by (uid=0)
Apr 20 12:32:10 s1 sudo:  user : TTY=unknown ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/sftp
Apr 20 12:32:10 s1 sshd[9358]: (pam_unix) session closed for user user

Apr 20 12:32:48 s1 sshd[9378]: subsystem request for sftp

Apr 20 12:55:56 s1 sshd[14453]: Accepted password for user from 12.34.56.78 port 63815 ssh2
Apr 20 12:55:56 s1 sshd[14455]: (pam_unix) session opened for user user by (uid=0)
Apr 20 12:55:56 s1 sshd[14455]: subsystem request for sftp
Apr 20 12:55:56 s1 sshd[14455]: error: subsystem: cannot stat internal-sftp: No such file or directory
Apr 20 12:55:56 s1 sshd[14455]: subsystem request for sftp failed, subsystem not found
Apr 20 12:55:56 s1 sudo:  user : TTY=unknown ; PWD=/home/user ; USER=root ; COMMAND=/bin/bash
Apr 20 12:56:00 s1 sshd[12526]: (pam_unix) session closed for user user
Apr 20 12:56:00 s1 sshd[14460]: Accepted password for user from 12.34.56.78 port 63816 ssh2
Apr 20 12:56:01 s1 sshd[14462]: (pam_unix) session opened for user user by (uid=0)
Apr 20 12:56:01 s1 CRON[14482]: (pam_unix) session opened for user root by (uid=0)    

You can see my different approaches...

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

I'm confused by the:
error: subsystem: cannot stat internal-sftp: No such file or directory
_________________
Martin Prikryl

Reply with quote

DaSilva
Joined:
Posts:
10
Location:
localhost

I have tried to set the subsystem to "internal-sftp" because of an entry from Google and that was the error message. So it is only another subsystem in the config which I tried (unsuccessfully).

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Then I do not see when entries in the log file corresponds to the actual test with sudo. Anyway, I can hardly help you with setting up your SSH server.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum