In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What is the purpose of the su command in a linux system? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
When we execute su with root, the su command creates a new shell process with the current shell process as the parent process, this shell process is provided to the user we want to su to, while the root shell process still exists, and vice versa, this is the reason for your question, because the previous user's shell process has not been closed, you can use exit to exit, you can see Instead of logging out, I went back to the previous user. Because they are parent-child processes, the end of the child process certainly does not affect the execution of the parent process. But if we forcibly kill the parent process, we just quit.
In fact, many people do not understand the difference between whoami and whoami, their roles are different.
Who am i displays the actual user ID of the current shell process.
Whomai displays the valid user ID for the current shell process.
In many cases, the two outputs are the same, so much so that we think the two commands have the same effect.
Example: root@yunhw-Aspire-4750G:~# who am i
Root pts/0 2011-12-10 13:13
Root@yunhw-Aspire-4750G:~# whoami
Root
Root@yunhw-Aspire-4750G:~#ps-ef
Root 2939 2935 0 13:18 pts/0 00:00:00 bash
Root@yunhw-Aspire-4750G:~# su-yunhw
Yunhw@yunhw-Aspire-4750G:~$ who am i
Root pts/0 2011-12-10 13:13
Yunhw@yunhw-Aspire-4750G:~$ whoami
Yunhw
Root@yunhw-Aspire-4750G:~#ps-ef
Root 2939 2935 0 13:18 pts/0 00:00:00 bash
Yunhw 2958 2939 0 13:19 pts/0 00:00:00 su-yunhw
Yunhw 2966 2958 7 13:19 pts/0 00:00:00-su
Root@yunhw-Aspire-4750G:~#sudo kill-9 2939
As soon as the order was carried out, it withdrew completely.
After reading the above, have you mastered the function of the su command in the linux system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.