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