Topic "How do I "sudo -u anotheruser -i" in SFTP"

Author Message
ihot
[View user's profile]

Joined: 2015-12-10
Posts: 3
Location: California Dreamer
Hi,
As soon as I log into Winscp session, I need to sudo as another user (such as oracleuser)
So tried a couple of different things:
1) in Advanced settings, Environment > SFTP I enter:

sudo -u oracleuser -i -c /usr/libexec/openssh/sftp-server

However, I get the error message:
Cannot initialize SFTP protocol. Is the host running a SFTP server?
If I only use /usr/libexec/openssh/sftp-server it works - because that's the path to our sftp server.
What am I doing wrong?

2) So tried this other way:
After I login as my userid, I select Commands > Open in Putty. Then I execute sudo -u oracleuser -i. I am able to sudo in Putty, but my Winscp session ignores that I sudo. (I know b/c It does not allow me access directories that oracleuser allows).
Please help. I do not have need to enter password when I sudo -u oracleuser -i
Thanks.
sftp configure.pdf (284.21 KB) [Download]

Description: (none)

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
ihot wrote:
sudo -u oracleuser -i -c /usr/libexec/openssh/sftp-server

However, I get the error message:
Cannot initialize SFTP protocol. Is the host running a SFTP server?

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
ihot
[View user's profile]

Joined: 2015-12-10
Posts: 3
Location: California Dreamer
Thanks. I attach my DEBUG2 log file.

Again, /usr/libexec/openssh/sftp-server works in winscp in Advanced setting> Environment > SFTP

When I log into putty, I had to execute:
sudo -u oracleuser -i


Merry Christmas to you all!
winscpDEBUG2.log (11.94 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
The SFTP channel was started, so it looks like the sudo succeeded. Though it's hard to tell remotely.

Do you have access to server-side logs. Anything useful there?
ihot
[View user's profile]

Joined: 2015-12-10
Posts: 3
Location: California Dreamer
As it turns out, our Linux admin had to enable terminal emulation for our oracleuser.
SFTP is working now - with sudo -u oracleuser /usr/libexec/openssh/sftp-server.
Thanks for your help.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License