Add a root account and set a password in linux

Source: Internet
Author: User

In linux, we use useradd to add users. However, this process is complicated and complicated for users to add permissions, the useradd command I introduced here can quickly add a root Super administrator and set the PASSWORD command. I hope it will be helpful to you.

Adding an account to the Intranet machine with the privilege escalation without the ECHO will make it difficult to set the password. The following is a command to add a root-level account and set the password.
Useradd-p 'openssl passwd-1-salt 'lsof'admin'-u 0-o-g root-G root-s/bin/bash-d/usr/bin/lsof lsof

Command explanation

Useradd Add User

-P'openssl passwd-1-salt 'lsof 'admin' indicates setting the user password. The lsof in it is similar to the key and can be written at will, admin is the plaintext Password

-U 0-o adds a user with a uid of 0 to the root level.
-G root-G root: add the user to the root group
-S/bin/bash: Specifies the shell path of the new user.
-D/usr/bin/lsof: Create the user's home directory, which can be customized.
Username of the user created by lsof

Ii. Clone an account

Of course, we can use the clone technology to directly create a root account.

Create common user system
# Useradd system
# Passwd system

Add root shell

# Vim/etc/passwd

System: x: 0: 0: root:/bin/bash

# Vim/etc/shadow
System: $1 $ OULjNnw/$ kAyt7S. RzTJwSwllflI3F1: 14921: 0: 99999: 7 :::

Add to root group

# Vim/etc/group
Root: 0: root, systems

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.