Generally speaking, adding users often use the “useradd ” command, the system can add users by default and set UID, GID and other information, in fact, behind this can be manually modified system File implementation.
We know that there are /etc.passwd, /etc/shadow, /etc/group files in the /etc directory. These three files store the user name (UID, GID, home directory, shell version used, etc.) of the system user, user password and user group information in the system. So we manually modify these files to achieve the purpose of adding users.
The steps are as follows: (add suse as an example)
1 /etc.passwd, /etc/shadow, add content in /etc/group. The format can be obtained by viewing the original file.
1 echo "suse:x:527:527::/home/suse:/bin/bash" >> /etc/passwd
2 echo "suse:x :527:" >> /etc/group
3 echo "$1$fegjjfefa$fwlgd8768fUbWF97o./geUnC.:15089:0:99999:7:::" >> /Etc/shadow
3 is more difficult to understand, “fegjjfefa$fwlgd8768fUbWF97o./geUnC” User password generated for MD5 encryption, 15089 is the setup time, 0 is the minimum password period, and 99999 is the maximum password duration. So we have to manually generate such field values. Can be achieved by the following command:
#openssl passwd -1 -salt XXXXXXXX The actual password (8 is not added to -salt XXXXXXXX, passwd -1 is generated by MD5 encryption)
# 15089 represents the number of days from the first year of Linux to the creation of users. Use this command to achieve: z=$[`date'+%s'`/86400] → z=15089
2
Now we still can't log in to new users because there is no home yet Directory
# mkdir /home/suse
#chown -R suse:suse /home/suse (Change the owner group of the home directory and limit the files in this directory to this owner Group)
#chmod 700 /home/suse
But still can't log in at this time, the system does not have the framework information, environment attribute information of this user.
3 Copy the .bash* under /etc/skel to the user's home directory.
# cp /etc/skel/.bash* /home/suse/
Next, you must confirm the permissions of these files, belonging to the main group.
At this point, manually add users to complete, you can log in to the host as suse.
Bill · Gates attitude towards software is: If you want good software, you have to pay for it.
In Windows, Sogou Pinyin input method has a large number of users because of its large vocabulary an
In recent years, the open source Linux system can be said to be in the limelight, whether it is pers
The Go language (ie Golang) is a programming language originally developed by Google. It has severa
Linux paging mechanism started (X86)
Linux mysql porting settings method
View the memory method used by a program under Linux
Linux Network Protocol Stack Network Device Management
AMH VPS control panel always fails to log in. The password is not registered.
Linux operating system network card installation guide (on)
Apache Reverse Proxy on the Linux Firewall
CentOS minimizes installation and then installs desktop and Chinese support
Establishing GPRS wireless Modem dialing method under Linux system
Linux shell script comprehensive learning
Tiny4412 assembly water light code, Tiny4412 bare metal LED operation
How can I solve the problem that Win7 can't install ActiveX control?
How to set up boot acceleration in win10 system?
Teach you how to improve the security of Win 7 system
Can't the Caps Lock button be closed? The master teaches you how to turn off the
Windows10 official version 10586.122 upgrade failed how to do
How does Win10 delete system temporary files?
How to enable or disable the built-in positioning function of Win10 by default
The first thing to do after installing Win8.1
Win10 10074 Second Patch Download Update: Fixing Edge Browser Issues