Create the root user on EC2 and log in with the root user

Source: Internet
Author: User

Today began to study the Amazon Cloud host EC2, encountered a problem, I need to install Tomcat on EC2, but the Yum command can only be root user to run, and EC2 default is to Ec2-user user login, so need to switch to the root user login, The results of the study are published as follows:

1, according to the method provided by the official website login to connect to the EC2 server (website recommended for Windows users to use Putty connection)

2, create the root password, 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 identity, enter the following command:

Su Root

5, use the root identity 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. To this, you can log in to EC2 server directly as root.

Create the root user on EC2 and log in with the root user

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.