- TroyB
- Joined:
- Posts:
- 3
Can you SU to root from a regular user in WinSCP somehow?
Advertisement
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?
Advertisement
-
martin◆
Site Admin -
- Joined:
- Posts:
- 35,414
- Location:
- Prague, Czechia
Re: Can you SU to root from a regular user in WinSCP somehow?
Please read FAQ
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◆
Site Admin -
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.
Yes, I just did it again and Putty works fine and without prompting. I just can't do it in WinSCP.
Advertisement
-
martin◆
Site Admin -
Please post a log file.
-
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.
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◆
Site Admin -
You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.
- Guest
My apologies prikryl. That worked flawlessly. Thank you.You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.
WinSCP is a great tool b/t/w, thanks for the generous contribution.
Advertisement
- Guest
My apologies prikryl. That worked flawlessly. Thank you.You cannot use "sudo" from terminal. You need to specify it as "shell" for the session. Please read the FAQ again.
WinSCP is a great tool b/t/w, thanks for the generous contribution.
how do you specify it as a shell?
-
martin◆
Site Admin -
Please read the FAQ!how do you specify it as a shell?
-
getfucked
Guest
Customer support.
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◆
Site Admin -
- Joined:
- Posts:
- 35,414
- Location:
- Prague, Czechia
Re: Customer support.
There's nothing to "get working". TheSimply 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.
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.
Advertisement
-
Bluscream
Guest

-
martin◆
Site Admin -
And the question is?
- Gogowitsch
- Joined:
- Posts:
- 1
- Location:
- Dresden
And now for file listings as root
This thread is about the Terminal window (Ctrl + T).
Let's talk about the core function of WinSCP instead:
I also needed access to directories like /root and /var/lib/mysql. After some tinkering with the settings I figured out that for Debian and Ubunutu, I have to open the Login -> Advances window, navigate to the 'SFTP' tree item and type sudo /usr/lib/openssh/sftp-server in the SFTP server box. This allowed me to use my non-root credentials to gain root access.
Let's talk about the core function of WinSCP instead:
I also needed access to directories like /root and /var/lib/mysql. After some tinkering with the settings I figured out that for Debian and Ubunutu, I have to open the Login -> Advances window, navigate to the 'SFTP' tree item and type sudo /usr/lib/openssh/sftp-server in the SFTP server box. This allowed me to use my non-root credentials to gain root access.
-
Gest
Guest
Im running Ubuntu 17.04. When you make a new session select SCP protocol and click on advanced settings. Then select SCP/Shell and write: /bin/bash -c "sudo -s"
on the server I have openssh installed
I have my user, e.g.: webdev added to the sudo group
And I had to add to /etc/sudoers the line: webdev ALL = NOPASSWD : ALL
so after hours of trying it finally works...
on the server I have openssh installed
I have my user, e.g.: webdev added to the sudo group
And I had to add to /etc/sudoers the line: webdev ALL = NOPASSWD : ALL
so after hours of trying it finally works...
Advertisement
-
schuess
Guest
thanks that worked
write in the Shell drop-down: /bin/bash -c "sudo -s"Im running Ubuntu 17.04. When you make a new session select SCP protocol and click on advanced settings. Then select SCP/Shell and
Thanks a lot. Got it to work. The FAQ was not that specific...
-
Vasiliy
Guest
this instructions worked for me (CentOS 7)
this instructions worked for me
https://oitibs.com/allow-root-winscp-file-transfer/
the command in my case was:
echo -e "MyUserName ALL=(ALL) NOPASSWD: /usr/libexec/openssh/sftp-server" > /etc/sudoers.d/winscp
and in advanced settings of SFTP:
sudo /usr/libexec/openssh/sftp-server
https://oitibs.com/allow-root-winscp-file-transfer/
the command in my case was:
echo -e "MyUserName ALL=(ALL) NOPASSWD: /usr/libexec/openssh/sftp-server" > /etc/sudoers.d/winscp
and in advanced settings of SFTP:
sudo /usr/libexec/openssh/sftp-server
-
Shreee
Guest
Root user
I need to switch to root user to download files from linux to windows as M getting permission denied after reaching till admin.Could you please help me with that??
Thanks
Shreee
Thanks
Shreee
-
martin◆
Site Admin -
- Joined:
- Posts:
- 35,414
- Location:
- Prague, Czechia
Re: Root user
This whole topic is about that. What did you try? Did you follow this guide?I need to switch to root user to download files from linux to windows as M getting permission denied after reaching till admin.Could you please help me with that??
https://winscp.net/eng/docs/faq_su
If you did, start a new thread, show us what did you try, and what problem are you facing.
Advertisement
-
mfiros
Guest
set the correct file ownership and permissions:
sudo chown -Rf ec2-user /var/www/mysite/location
sudo chmod -Rf 755 /var/www/mysite/location
sudo chmod -Rf 755 /var/www/mysite/location
Advertisement
You can post new topics in this forum