1、id命令用于反馈用于ID,所属组ID,(所属组名 ?)
使用root测试结果:
[root@linuxprobe home]# whoami ## root用户 root [root@linuxprobe home]# echo $USER root [root@linuxprobe home]# id root ## 测试root账户,可以正常反馈 uid=0(root) gid=0(root) groups=0(root) [root@linuxprobe home]# id linuxprobe ## 测试普通用户,可以正常反馈 uid=1000(linuxprobe) gid=1000(linuxprobe) groups=1000(linuxprobe) [root@linuxprobe home]# id xxxxx ## 测试不存在的账户 id: ‘xxxxx’: no such user
2、使用普通用户测试
[linuxprobe@linuxprobe home]$ whoami ## 测试结果同上 linuxprobe [linuxprobe@linuxprobe home]$ echo $USER linuxprobe [linuxprobe@linuxprobe home]$ id root uid=0(root) gid=0(root) groups=0(root) [linuxprobe@linuxprobe home]$ id linuxprobe uid=1000(linuxprobe) gid=1000(linuxprobe) groups=1000(linuxprobe) [linuxprobe@linuxprobe home]$ id yyyy id: ‘yyyy’: no such user