博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux中切换用户方式su和su -的区别
阅读量:7292 次
发布时间:2019-06-30

本文共 1496 字,大约阅读时间需要 4 分钟。

  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.

转载于:https://www.cnblogs.com/rusking/p/5591378.html

你可能感兴趣的文章
java通过句柄访问对象
查看>>
extern "C"与C++中的C函数调用(4)—— 如何在C中调用C++函数
查看>>
计算几何 模板
查看>>
“The Psychology of Cross Country”笔记
查看>>
10 Web Apps for Developers 为开发者提供的10款Web应用程序
查看>>
python之正则表达式
查看>>
Shell命令-文件及目录操作之touch、tree
查看>>
修改K/3 Cloud管理中心端口
查看>>
C#语言课程11月7日
查看>>
linux日常1-踢出用户
查看>>
MFC多文档应用程序同时显示两个视图
查看>>
github快速入门(一)
查看>>
PHP全栈开发(八):CSS Ⅸ dispaly & visibility
查看>>
正则表达式
查看>>
【Oracle 12c】最新CUUG OCP-071考试题库(56题)
查看>>
C#使用Xamarin开发可移植移动应用进阶篇(6.使用渲染器针对单个平台自定义控件..很很很很重要..),附源码...
查看>>
实验二
查看>>
简单安装ubuntu
查看>>
20160331javaweb 之JSP page 指令
查看>>
用Ruby批量获取电影的评分与影片信息
查看>>