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.

  • 相关阅读:
    一类涉及矩阵范数的优化问题
    MATLAB小实例:读取Excel表格中多个Sheet的数据
    深度多视图子空间聚类
    具有协同训练的深度嵌入多视图聚类
    结构深层聚类网络
    一种数据选择偏差下的去相关聚类方法
    shell编程基础二
    shell编程基础一
    如何处理Teamcenter流程回退情况
    汽车行业数字化车间解决方案
  • 原文地址:https://www.cnblogs.com/rusking/p/5591378.html
Copyright © 2011-2022 走看看