1.10. User management commands
1.10.1.useradd
Add new user
Add a user called test, just basic information, no password set
[root@localhost ~]# useradd test
[root@localhost ~]#
1.10.2.passwd
Set user password
When adding a user, it is only basic information and no password is set, so if you want to log in, you need to set a password.
When there is no username after passwd, the current user is modified.
Only root can change the passwords of all users, and every other ordinary user can only change their own passwords.
[root@localhost ~]# passwd test
Changing password for user test.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
1.10.3.who
View the login user information to see which users are currently logged in
[root@localhost ~]# who
root pts/0 2018-04-26 22:47 (192.168.1.101)
test pts/1 2018-04-26 23:07 (192.168.1.101)
Login Username Login Terminal Login Time IP Address
tty is called local login, similar to the console login of the virtualization platform
pts is called remote login, using moba, xshell and other remote tools to log in through ssh.
1.10.4.w
More detailed login information than who
[root@localhost ~]# w
23:11:10 up 7:08, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.1.101 22:47 6.00s 0.00s 0.00s w
test pts/1 192.168.1.101 23:07 3:57 0.00s 0.00s -bash
[root@localhost ~]#
23:11:10 Current system startup time
up 7:08 This machine runs continuously for 7 hours, a reference parameter to measure the stability of the server
2 users The number of users logged in is 2.
Load average: 0.00, 0.01, 0.05 The load balancing index records the system load in 1 minute, 5 minutes, and 15 minutes, mainly referring to the state of the CPU responsible for balancing. A large value indicates a severe load.
IDLE indicates how long the user has been idle after logging in
JCPU Cumulative CPU time occupied by operations
PCPU Indicates the CPU time occupied by the current operation performed after the user logs in
What WHAT is currently doing