zoukankan      html  css  js  c++  java
  • linux中切换用户方式su和su -的区别

      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.

  • 相关阅读:
    【摘录】使用实体框架、Dapper和Chain的仓储模式实现策略
    关于微软HttpClient使用,避免踩坑
    在网上摘录一段对于IOC的解析,比较直观,大家观摩观摩
    经历招聘中面试求职的点滴
    在面试中忽然发现DateTime的一些...
    GCC的内存边界对齐
    如何删除Weblogic域
    电蚊拍选购参考
    Localizing WPF with .resx files
    C#操作串口总结
  • 原文地址:https://www.cnblogs.com/rusking/p/5591378.html
Copyright © 2011-2022 走看看