用户切换
用户切换
[root@localhost ~]# id
uid=0(root) gid=0(root) 组=0(root)
[root@localhost ~]# whoami
rootsu 命令
[root@localhost ~]# su - test
上一次登录:四 8月 2 22:33:52 CST 2018pts/0 上
[test@localhost ~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/test/.local/bin:/home/test/bin
[test@localhost ~]$ exit
登出
[root@localhost ~]# su test
[test@localhost root]$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[test@localhost root]$ exit
exit
[root@localhost ~]# su - test
上一次登录:四 8月 2 22:46:07 CST 2018pts/0 上
[test@localhost ~]$ su -
密码:
上一次登录:四 8月 2 21:39:44 CST 2018从 192.168.127.1pts/0 上
[root@localhost ~]# id
uid=0(root) gid=0(root) 组=0(root)
[root@localhost ~]# su --c "touch 11.txt" test
touch: 无法创建"11.txt": 权限不够
[root@localhost ~]# su --c "touch /tmp/1.txt" test
[root@localhost ~]# ls -l /tmp/1.txt
-rw-r--r-- 1 test test1 0 8月 2 22:47 /tmp/1.txt普通用户使用root权限
最后更新于