linux cdig 工具,linux常用工具su与su -
2013年3月5日 星期二? 3月10日整理筆記
一、創建用戶chenglong
[root@localhost ~]# useradd chenglong
[root@localhost ~]# vi /etc/shadow
二、對比
1、使用su
[root@localhost ~]# su chenglong
查看路徑
[chenglong@localhost root]$ pwd
/root
在根下,危險
[chenglong@localhost root]$ pwd
/root
創建目錄
[chenglong@localhost root]$ mkdir kuaicanche
mkdir: cannot create directory `kuaicanche': Permission denied??? #失敗
創建文件
[chenglong@localhost root]$ touch kuaicanche
touch: cannot touch `kuaicanche': Permission denied?????????????? #失敗
[chenglong@localhost root]$
退出
[chenglong@localhost root]$ exit
exit
2、使用su -
[root@localhost ~]# su - chenglong
查看路徑
[chenglong@localhost ~]$ pwd
/home/chenglong
[chenglong@localhost ~]$
[chenglong@localhost ~]$ mkdir shiershengxiao
[chenglong@localhost ~]$ cd
[chenglong@localhost ~]$ exit
logout
[root@localhost ~]# find / -name shiershengxiao
/home/chenglong/shiershengxiao?????????????????????????????????? #成功
在用戶自己家目錄下,安全
三、執行一次指令
[root@localhost ~]# su - chenglong -c 'mkdir /tmp/test'
[root@localhost ~]# cd /tmp
[root@localhost tmp]# ls
gconfd-root???? mapping-root? ssh-mLbITh2442? virtual-root.x90iG7
keyring-KvMtAQ? orbit-root??? test
[root@localhost tmp]#
總結
以上是生活随笔為你收集整理的linux cdig 工具,linux常用工具su与su -的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内蒙古鄂尔多斯市污水处理等级标准由一级A
- 下一篇: Linux中sysstat服务,Linu