标签:
Linux下切换用户的命令。比较常用的用法:
1)不切换当前用户,只用指定用户的权限去执行一条命令
jerry@ubuntu:/tmp$ su -c "ls /tmp" root Password: ? ThisDIr vmware-file-mod0 config-err-6ha607 unity_support_test.0 vmware-guest-oPvIa8 config-err-NDGsUe vgauthsvclog.txt.0 vmware-guest-QC4Egw config-err-yvEI5R VMTools vmware-jerry dir2 vmware-config0 vmware-root guest-oPvIa8 vmware-config1 VMwareTools-10.0.0-2977863.tar.gz guest-QC4Egw VMwareDnD jerry@ubuntu:/tmp$
2)切换用户并指定bash
jerry@ubuntu:/tmp$ su -s /bin/bash jerry Password: jerry@ubuntu:/tmp$ su -s /bin/sh jerry Password: $
标签:
原文地址:http://www.cnblogs.com/jenrrychen/p/5022686.html