AWS to root user login

  For just created AWS EC2 instances or AWS instances often used for small partners, EC2 instances you just created is not ROOT privileges, can not be used directly ROOT users to landing instance, you can not get to the root. Under normal circumstances, EC2 instance is the default user name ec2-user to login (except Ubuntu system instance, its default user name is ubuntu). And how to create a root password, and change the way users log in - to root user login instance, it becomes necessary. Below is to help you how to create a root password, and how to ROOT user login instances.

  I ubuntu instance has just created its own to explain to the next.

    In EC2 instances you just created, we can only use ubuntu user to login, if the user attempts to log in as ROOT, then that instance will prompt the following information.

      

Please login as the user “ubuntu” rather than the user “root”.

 

1. How to create and set a password ROOT

   input the command:

                 sudo passwd root                                                                           

   然后在下面的提示中输入你为ROOT用户设置的密码                                       
      Enter new UNIX password:#输入自己设置的新密码                                                

      Retype new UNIX password:#再次输入                                                    

   创建完成后,使用ROOT登陆实例

     input the command:  

       su root                                                                                                                                                                                                              
                    password ## input just set: Password                                                                                                                                                                 
 

   So far, we have successfully created a password to ROOT, it is not very simple!

2. Change landing approach, using ROOT user login

  Before setting, we must ensure that the current user is the ROOT, if not, still use the command 'su root', switch to root for the instance of the user.

    a. Edit ssh login EC2 instances

      Edit SSH file / etc / ssh / sshd_config, find PasswordAuthentication row to the back of no change yes, then find PermitRootLogin, the same will be back no change yes. Finally back UsePAM yes changed to no.

      input the command:

        vim /etc/ssh/sshd_config                                                                                                                                                                         

    b. and then edit the authorized_keys file, ssh-rsa delete all the previous text, to ensure that ssh-rsano text, including spaces.

      input the command:

        sudo vim /root/.ssh/authorized_keys                                                       

               

    

3. Re-landing

  After completing all the settings, exciting the last step,

service sshd restart

Reopen putty (or Xshell), direct use of ROOT landing.

  

Guess you like

Origin blog.csdn.net/dongheli/article/details/91419026