Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of su and sudo in linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what is the use of su and sudo in the linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Generally speaking, we will recommend that you do not log in to the server directly using the root account, but use the ordinary account to log in, and wait until you have to use the root user to switch identities. Next, let's talk about the two identity switching commands su and sudo.

Su

The su command is used to switch from the current user to the new user, and when switching to the new user identity, you need to enter the password of the switching user.

General usage: su-user name

-or-l: when you change your identity, you also change the working directory and HOME,SHELL,USER,logname. In addition, the PATH variable will be changed

Here is a demonstration of the use of this command:

$id # the current user is adminuid=1005 (admin) gid=1006 (admin) groups=1006 (admin) $su-# if you do not enter a user name, you will switch to the root user Password:

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report