Linux commands for creating users
Useradd-g test-d/home/test1-s/etc/bash-m test1
Note:-G belongs to group- D home Directory
Delete User command
Userdel-r test1
Create password command
passwd
See which command the user group is under Linux!
View/etc/group File
With cat/etc/passwd |cut-f 1-d:
How Linux prohibits users from logging on remotely:
1. When adding a new user, specify that the user cannot log in remotely
Useradd-s/sbin/nologin ZGSJ//This is the creation of a ZGSJ user who cannot log in remotely
passwd ZGSJ//modify ZGSJ user password
1, prohibit individual users to log in. For example, prohibit ZGSJ users from logging in.
Passwd-l ZGSJ//Lock ZSGJ User, disable ZGSJ user login
This means locking the ZGSJ user so that the user cannot log on.
Passwd-u ZGSJ//unlock ZSGJ user, allow ZGSJ user to log in
The locked user ZGSJ is unlocked and the user can log in.
2, we modify the/etc/passwd file in the user login shell to implement Linux prohibit user login
vi/etc/passwd
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
Sync:x:5:0:sync:/sbin:/bin/sync
Shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
Halt:x:7:0:halt:/sbin:/sbin/halt
Mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
Uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
Operator:x:11:0:operator:/root:/sbin/nologin
Games:x:12:100:games:/usr/games:/sbin/nologin
Zgsj:x:500:500::/home/lynn:/bin/bash
Change to:
Zgsj:x:500:500::/home/lynn:/sbin/nologin
The user will not be able to log in.
3. Prohibit all users from logging in.
Touch/etc/nologin
Users other than root cannot log in.
Linux commands for creating users