Connect to Amazon’s Linux via WinSCP as root

This post was published 6 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

SCP offers a number of advantages over FTP, not the least of which include no setup (you don’t need an FTP server) and increased security. However, when setting up a server, it can be rather inconvenient to be unable to save a file to most directories.

The simplest solution, really, is to just upload the file as root – probably not the best idea from a security perspective, but it really does save a lot of effort when you are copying configuration files back and forth between machines.

The following is specifically with reference to Amazon’s Linux (and works at least up to v2011.09).

On the EC2 instance:

  • Run visudo
  • Comment out Defaults requiretty (line 55) (or change to Defaults !requiretty)

In WinSCP:

  • Under Session:
    • Set the username to same username you login with (the default is ec2-user)
    • Change the File protocol to ‘SCP’
  • Under Environment > SCP/Shell:
    • Change the shell to sudo su -

Login and you should find yourself in /root. Once you no long need to use SCP as root, it may be advisable to re-enable requiretty.

3 thoughts on “Connect to Amazon’s Linux via WinSCP as root

Leave a Reply

Your email address will not be published. Required fields are marked *