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

Advertisement

ihot
Joined:
Posts:
3
Location:
California Dreamer

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

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,556
Location:
Prague, Czechia

Re: How do I "sudo -u anotheruser -i" in SFTP

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.

Reply with quote

ihot
Joined:
Posts:
3
Location:
California Dreamer

Re: How do I "sudo -u anotheruser -i" in SFTP

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!

Reply with quote

martin
Site Admin
martin avatar

Re: How do I "sudo -u anotheruser -i" in SFTP

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?

Reply with quote

ihot

solved!!

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.

Reply with quote

Advertisement

You can post new topics in this forum