Using su

The  su  command allows users to open a terminal window, and from that terminal start a sub shell in which the user has another identity. To perform administrative tasks, for instance, you can log in with a normal user account and type  su  to open a root shell. This brings the benefit that only in the root shell root privileges are used.

If just the command  su  is typed, the username root is implied. But su can be used to run tasks as another user as well. Type  su linda  to open a subshell as the user linda, for example. When using  su  as an ordinary user, you are prompted for a password and after entering that you have acquired the credentials of the target user:

[linda@localhost ~]$ su  Password:

[root@localhost linda]#   
      When using  su , a sub shell is started. This is an environment where you are able to work as the target user account, but environment settings for that user account have not been set. If you need complete access to the entire environment of the target user account, you can use  su -  to start a login shell. If you start a login shell, all scripts that make up the user environment are processed, which makes you work in an environment that is exactly the same as when logging in as that user.   (使用su - 切换到其它用户,不要使用su直接切换)

TIP

Using  su -  is better than using  su . When the  -  is used, a login shell is started, without the  - , some variables may not be set correctly. So, you are better off using  su -  immediately.

最新文章

  1. Kafka 文档用例
  2. JBOSS通过Apache负载均衡方法一:使用mod_jk
  3. Redis教程(七):Key操作命令详解
  4. 在Android上使用fontAwesome
  5. python时间处理函数
  6. tcpdump学习
  7. CSS常用布局整理(二)
  8. CentOS-6.3安装配置Nginx
  9. DOM 之 document 查找元素方法
  10. angular中设置$http的post请求的数据传递格式
  11. jar 包和批量处理
  12. 从51跳cortex-m0学习2——程序详解
  13. lodoop打印控制具体解释
  14. io的四个分类
  15. ldd获得可执行程序的所有库并输出到指定目录
  16. linux统计多个文件大小总和
  17. JavaScript 将两个数组合并,且删除重复的值
  18. 21.PHP实现Word/Excel/PPT转换为PDF
  19. java中用jdom创建xml文档/将数据写入XML中
  20. [C++]Linux之文件拷贝在系统调用和C库函数下的效率比较

热门文章

  1. IDEA14下配置SVN
  2. Android之声音管理器《AudioManager》的使用以及音量控制
  3. PHP获取函数返回值的引用
  4. jQuery MVC 科室异步联动
  5. ViewData与ViewBag比较
  6. d037: 鸡兔同笼
  7. HTML邮件注意事项
  8. ZedGraph控件生成饼图、拆线图和柱状图例程
  9. stringstream复用【原创】
  10. poj 1195Mobile phones