Is it possible to use the sftp plugin for connection with a linux system and to do a sudo command to get root privileges after login ?
I managed to do this with WINSCP by using scp protocol and not sftp and supply the sudo command in a field in the preferences. I tried this with the sftp plugin and checked te scp boxes in the settings and issue the sudo command on the commandline of TC. But no luck.
Does anyone know if this is possible ?
Greetings
SFTP plugin and sudo to root ?
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: SFTP plugin and sudo to root ?
No, unfortunately the used SSH library does not allow to open an SFTP session via root shell.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: SFTP plugin and sudo to root ?
The SFTP plugin opens a connection with root without any problems and the directories are then read without any problems and files are copied back and forth without any problems as root.
It may be that the noninteractive shell cannot (continue to) run as root, I haven't tested that yet. Above all, because the noninteractive shell is terminated after each command (command from within the Tc command line).
But it is perfectly possible to run commands with sudo _within_ scripts running on the remote system.
It should be noted, however, that interactive input is not possible. The user who calls sudo in the script must therefore be entered in sudoer in such a way that NOPASSWD is specified for him.
It may be that the noninteractive shell cannot (continue to) run as root, I haven't tested that yet. Above all, because the noninteractive shell is terminated after each command (command from within the Tc command line).
But it is perfectly possible to run commands with sudo _within_ scripts running on the remote system.
It should be noted, however, that interactive input is not possible. The user who calls sudo in the script must therefore be entered in sudoer in such a way that NOPASSWD is specified for him.
- ghisler(Author)
- Site Admin
- Posts: 50532
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: SFTP plugin and sudo to root ?
What I mean is that you can't login as normal user (SSH connection) and then try to access files via sudo of the SFTP process. Remote login with user root is often prohibited.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: SFTP plugin and sudo to root ?
That's right.
Re: SFTP plugin and sudo to root ?
Thank you both for clarifying. I didn't understand the second answer but now I do.