Topic "Can you SU to root from a regular user in WinSCP somehow?"

Author Message
TroyB
[View user's profile]

Joined: 2006-07-18
Posts: 3
I know generally you can't execute commands that require input (root password) but I was wondering if there was any way to pull this off?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Please read FAQ
_________________
Martin Prikryl
TroyB
[View user's profile]

Joined: 2006-07-18
Posts: 3
Thank you for the response. I still can't get it to work. I edited the /etc/sudoers and added in the user account as it suggested and now I can do an 'sudo su' and it switches me to root with no prompting for password. But I still can't get it to work within WinSCP. It just times out.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Can you try to login using PuTTY and specify "/bin/bash -c 'sudo su -'" as "Remote command" (on SSH tab)? Would it connect automatically without any prompt? Or post a log file.
TroyB
[View user's profile]

Joined: 2006-07-18
Posts: 3
Yes, I just did it again and Putty works fine and without prompting. I just can't do it in WinSCP.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Please post a log file.
_________________
Martin Prikryl
billguy

Guest


Guess I'll pick it up where he left off:

same issue, read the faq, using WinSCP 3.82, here's my log:

. 2006-09-25 12:28:05.843 Startup conversation with host finished.
. 2006-09-25 12:28:17.000 Executing user defined command.
> 2006-09-25 12:28:17.000 sudo su ; echo "WinSCP: this is end-of-file:$?"
. 2006-09-25 12:28:32.001 Waiting for data timed out, asking user what to do.
. 2006-09-25 12:28:32.001 Asking user:
. 2006-09-25 12:28:32.001 Host has not answered for 15 seconds.
. 2006-09-25 12:28:32.001
. 2006-09-25 12:28:32.001 Wait for another 15 seconds? Pressing 'Abort' button will close session. ()
. 2006-09-25 12:28:38.361 Attempt to close connection due to fatal exception:
* 2006-09-25 12:28:38.361 Terminated by user.
. 2006-09-25 12:28:38.361 Closing connection.
* 2006-09-25 12:28:38.361 (ESshFatal) Terminated by user.

FWIW I'm on Ubuntu 6.06, my sudoers looks like so:

myusername ALL=NOPASSWD: ALL

I am not prompted for a password from the console/putty when I do a 'sudo su'.

Stumped.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.
_________________
Martin Prikryl
Guest




prikryl wrote:
You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.

My apologies prikryl. That worked flawlessly. Thank you.
WinSCP is a great tool b/t/w, thanks for the generous contribution.
Guest




Anonymous wrote:
prikryl wrote:
You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.

My apologies prikryl. That worked flawlessly. Thank you.
WinSCP is a great tool b/t/w, thanks for the generous contribution.



how do you specify it as a shell?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Quote:
how do you specify it as a shell?

Please read the FAQ!
_________________
Martin Prikryl
getfucked

Guest


Simply put, the coder cant manage to get this working so we have to do a work around then get "READ THE FAQ!" anytime anyone asks about it. You're an arsehole.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
getfucked wrote:
Simply put, the coder cant manage to get this working so we have to do a work around then get "READ THE FAQ!" anytime anyone asks about it. You're an arsehole.

There's nothing to "get working". The su is explicitly made not to be automatable for security reasons. As you are trying to break the security, you have to do it the hard way. There's no magical way.
Bluscream

Guest


[/img]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
And the question is?
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