Linux command exercise: Manually add Users

Source: Internet
Author: User

Manually add user hive, Base Group Hive (5000), additional group MyGroup

1. Vim/etc/group Manually add hive group information to the group configuration document and use MyGroup as an additional group for the hive user

Mygroup:x:5001:hive add hive to the MyGroup group information, as an additional group

hive:x:5000: Adding hive Group information

2. Vim/etc/gshadow Manually add hive group information to the group password configuration document

hive:!:: Add hive Group password information

3. vim/etc/passwd Manually add hive user information to the User Configuration document

Hive:x:5000:5000:hive:/home/hive:/bin/bash Adding HIVE User information

4. Vim/etc/shadow Manually add hive user information to the user password configuration document

hive:!! : 17088:0:99999:7::: Here are the 17088 calculation methods described below

Attached: How to change the last password modification date into days as follows

[[Email protected] ~]# Date +%s first show the date of the day in seconds

1476431406

[[email protected] ~]# BC Calculator command

BC 1.06.95

Copyright 1991-1994, 1997, 1998, 2004, 2006 Free Software Foundation, Inc.

This is the free software with absolutely NO WARRANTY.

For details type ' warranty '.

1476431406/86400 seconds of the day, divided by the number of seconds per day, 24*3600 seconds =86400 seconds

17088 calculates the date of the day from 1970 to 17088 days

5, Cp-r/etc/skel/home/hive set up hive user's home directory

[Email protected] test]# cp-r/etc/skel/home/hive

[Email protected] test]# ls-l/Home

DRWX------. 3 Donggen donggen 4096 September 23:26 Donggen

Drwxr-xr-x. 3 root root 4096 October 15:56 hive Hive Home directory has been built.

6, Chown-r hive.hive/home/hive the hive home directory and the contents of the user and group are modified to hive

[Email protected] test]# chown-r hive.hive/home/hive

[Email protected] test]# ls-la/home/hive

Drwxr-xr-x. 3 hive hive 4096 October 14 15:56.

Drwxr-xr-x. 7 root root 4096 October 14 15:56..

-rw-r--r--. 1 Hive Hive 18 October 15:56. bash_logout

-rw-r--r--. 1 Hive Hive 176 October 15:56. Bash_profile

-rw-r--r--. 1 hive Hive 124 October 15:56. BASHRC

Drwxr-xr-x. 2 hive hive 4096 October 15:56. gnome2

7, Chmod-r go=/home/hive set the Hive home directory group and other people's permissions to null

[Email protected] test]# chmod-r go=/home/hive

[Email protected] test]# ls-al/home/hive

DRWX------. 3 hive hive 4096 October 14 15:56.

Drwxr-xr-x. 7 root root 4096 October 14 15:56..

-RW-------. 1 Hive Hive 18 October 15:56. bash_logout

-RW-------. 1 Hive Hive 176 October 15:56. Bash_profile

-RW-------. 1 hive Hive 124 October 15:56. BASHRC

DRWX------. 2 hive hive 4096 October 15:56. gnome2

The hive user is manually added, but at this point it is not possible to log in to the hive user via the terminal and need to set a password for hive

Can be set through passwd, here is how to manually add the password to the shadow document.

8. Manually add the hive password information to the shadow user password configuration document

First through the OpenSSL passwd-1-salt to generate the password encryption string through the OpenSSL command-1 Here is the number 1

Openss1 passwd-l-salt

[[email protected] test]# OpenSSL passwd-1-salt ' 12345678 '

Password:

$1$12345678$0me5n6odyoeawup7b5udm/

[Email protected] test]# Vim/etc/shadow

Hive:$1$12345678$0me5n6odyoeawup7b5udm/:17088:0:99999:7:::

Copy the generated password encryption string into the user password configuration document


The complete hive user is then manually added successfully and can be remotely remote.

This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1861960

Linux command exercise: Manually add Users

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.