linux 中如何檢視當前建立的所有使用者
阿新 • • 發佈:2022-04-01
1、系統
[root@centos7pc1 test2]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release7.9.2009 (Core) Release: 7.9.2009 Codename: Core
2、使用 grep bash /etc/passwd 檢視當前所有建立的使用者
[root@centos7pc1 test2]# grep bash /etc/passwd ## 一共三個使用者 root:x:0:0:root:/root:/bin/bash liujiaxin01:x:1000:1000:liujiaxin01:/home/liujiaxin01:/bin/bash liujiaxin02:x:1001:1001::/home/liujiaxin02:/bin/bash
3、建立一個使用者進行驗證
[root@centos7pc1 test2]# useradd liujiaxin03[root@centos7pc1 test2]# echo "abc123456" | passwd --stdin liujiaxin03 Changing password for user liujiaxin03. passwd: all authentication tokens updated successfully. [root@centos7pc1 test2]# grep bash /etc/passwd ## 一共四個使用者 root:x:0:0:root:/root:/bin/bash liujiaxin01:x:1000:1000:liujiaxin01:/home/liujiaxin01:/bin/bash liujiaxin02:x:1001:1001::/home/liujiaxin02:/bin/bash liujiaxin03:x:1002:1002::/home/liujiaxin03:/bin/bash