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:


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.

======== still have a lot of basic commands to use, like vim.

I. So how to install vim?
Enter the Rpm-qa|grep vim command, and if Vim is properly installed, it will return the following three lines of code:

[email protected] [~] # rpm -qa|grep vim vim-enhanced-7.0.109-7.el5 vim-minimal-7.0.109-7.el5 vim-common-7.0.109-7.el5

If one of the strips is missing, such as vim-enhanced, use the command yum-y install vim-enhanced Laian:

yum -y install  vim-enhanced

If none of the above three strips is returned, you can use the Yum-y install vim* command directly

yum -y install  vim*

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: 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.