Log on with the root user on AWS EC2

Source: Internet
Author: User

AWS EC2 is logged on by default using the Ec2-user account and has no permissions on many folders. How to execute a command with the root account is a problem. The solution is as follows:

1. Log in to the EC2 server according to the method provided by the official website (recommended for Windows users to use Putty connection)

Host: Is the public DNS port for the server: 22

2. Create the root password and enter the following command:

sudo passwd root

3. You will then be prompted to enter new password. Enter a password for the root you want to set, and you need to enter it again for verification.

4. Next, switch to root and enter the following command:

Su Root

5. Use root to edit the Amazon Cloud host SSH login method, find Passwordauthentication No, change no to Yes. Input:

Vim/etc/ssh/sshd_config

6. Next, to restart the next sshd, such as the following command:

Sudo/sbin/service sshd Restart

7. Then switch to root identity

Su Root

8. Add the login password for the original "Ec2-user". As the following command:

passwd Ec2-user

Follow the prompts and enter your password two times.

9. Modifying the sshd configuration file

Vi/etc/ssh/sshd_config

PermitRootLoginThis line should read

Permitrootlogin Yes

PasswordAuthentication noSwitch

Passwordauthentication Yes

UsePAM yesSwitch

Usepam No

10. Restart the AWS VPS and you will be able to log in using root

Source: The blog "Using root user Login on AWS EC2" reproduced from the Luang-Zun blog

Link Address: http://www.luanzun.com/126.shtml

Log on with the root user on AWS EC2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.