开发者

How can I login to amazon ec2 with root directly in PuTTY or WinSCP?

  1. How can I login to Amazon EC2 with root directly in PuTTY??

    Each time I need to su - root first and change to root... Is there any other ways??

  2. How can I login to Amazon EC2 with root directly in Win开发者_如何学PythonSCP or Filezilla??

Since I want to "push" the file to some directly from my computer, but I cannot do this (e.g. create dir when login with ec2-user)


Change the PermitRootLogin setting from no to yes in your sshd_config file, then restart your SSH server.


When setting up a server, 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.

On the EC2 instance run:

# visudo  (or edit /etc/sudoers)
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 -' (available in the dropdown)

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

Source: http://www.thatsgeeky.com/2011/10/connect-to-amazons-linux-via-winscp-as-root/


  1. With WinSCP you should first identify the location of the sftp-server

You can run the following command:

find / -name sftp-server

In my case, the location was: /usr/libexec/openssh/sftp-server

The previous location should be configured in WinSCP in your session: Advanced Site Setting > SFTP > SFTP Server

sudo /usr/libexec/openssh/sftp-server


I use Filezilla to login, and follow the steps below.

To connect to a running Amazon EC2 instance with Filezilla:

  1. Edit -> Settings -> Connection -> SFTP Click "Add keyfile"

  2. Browse to the location of your .pem file and select it.

  3. A message box will appear asking your permission to convert the file into ppk format. Click Yes, then give the file a name and store it somewhere.

  4. If the new file is shown in the list of Keyfiles, then continue to the next step. If not, then click "Add keyfile..." and select the converted file.

  5. File -> Site Manager

  6. Add a new site wih the following paramerters:

    Host: Your public dns name of ec2 instance

    Protocol: SFTP

    Logon Type: Normal

    User: ec2-user

Press Connect Button

Video Tutorial: Click Here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜