Linux – How to change user in WinSCP

linuxputtysudounixwinscp

I'm using WinSCP to access Unix computers. How can I change user after I have logged into a Unix server using WinSCP?

E.g. I have personal account in Unix computer A. I can log into this computer using PuTTY and then change user to root user

$sudo /usr/bin/su - rootuser

How can I do the same thing using WinSCP? I don't know the password for rootuser.

Best Answer

I'm going to assume you can already sudo to the user in question ... ... in WinSCP setup for a new site:

  1. New Site
  2. Session: File protocol: SCP
  3. Session: host name: my-host-name
  4. Session: user name: MY-user-name
  5. CLICK Advanced... BUTTON
  6. Advanced: left-hand-navigator select SCP/Shell
  7. Advanced:Shell: MAGIC-HAPPENS-HERE The "pick list" for Shell has "Default" selected. You will enter TEXT here...

    /usr/bin/sudo -u TARGET-user-name -i

(above command varies by unix distro)

  1. NO-OTHER-CHANGES to the default settings, just select OK to close the Advanced window and save your changes.

..... this should be all you need!

Related Question