Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

0 down vote favorite

1) How can I login 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 amazon ec2 with root directly in winscp 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)

share|improve this question
    
Allowing direct root logins from the internet is contrary to industry-standard security practices. –  Skyhawk Jul 28 '11 at 6:04
    
The industry standard security practices are antiquated in this regard. –  anastrophe Jul 28 '11 at 6:41
add comment

2 Answers

WinSCP supports SSH keys.

In /etc/ssh/sshd_config set

PasswordAuthentication No
PermitRootLogin without-password

Copy your public key to /root/.ssh/authorized_keys (there will be a similar file inside of ec2-user's home directory). If you want to just copy that type

sudo mkdir -p /root/.ssh
sudo cp /home/ec2-user/.ssh/authorized_keys /root/.ssh/

This way you can login as root but only with ssh keys. If you have already assigned a password to root, you can disable the password on the account by typing:

sudo passwd -l root

You will also need to reload ssh:

sudo service sshd reload

Assuming you have already converted the amazon public key file to putty format, point WinSCP to that private key file and you should be able to login without a password. If you have not converted the key file you can use puttygen to do so.

share|improve this answer
    
Nice one! This is a secure way to use WinSCP. –  Sid Vel Nov 3 '11 at 10:55
add comment

Edit /etc/ssh/sshd_config, change these lines

PermitRootLogin forced-commands-only
PasswordAuthentication no

To:

PermitRootLogin yes
PasswordAuthentication yes

Set a password for root and restart sshd.

passwd
service sshd reload

Disclaimer: I don't recommend this at all, but since you asked I'll give you the gun - you decide what to do with it.

share|improve this answer
    
the main reason i want to do this is I need to transfer file from my local PC to server...the way i usual use is through winscp..however, i can just transfer file from server to local, but from local to server fail...i know it is very dangerous to let root access directly..but do you have any way to transfer file? –  red23jordan Jul 28 '11 at 6:32
    
chmod 777 /drop and use WinSCP normally to drop your files into that folder. –  bobobobo Apr 23 '13 at 2:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.