In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Linux su, sudo, sudo su, sudo-I command how to use the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that you read this Linux su, sudo, sudo su, sudo-I command how to use the article will have a harvest, let's take a look at it.
In Linux systems, because of the excessive authority of root, it is generally not used. Login root is used to perform administrative tasks only in some special cases. In general, temporary use of root permissions often uses su and sudo commands.
The su command is a tool for switching users. How do you understand it? For example, we log in as an ordinary user tom, but to add user tasks and execute useradd, the tom user does not have this permission, which is precisely owned by root. There are two solutions: one is to quit tom users and log in as root users again, but this is not the best solution; the other is that we do not need to quit tom users, we can use su to switch to root to add users, and then quit root after the task is completed.
We can see that switching through su is of course a better way; you can switch between users through su, while super-privileged user root does not need a password to switch to a normal or virtual user, while an ordinary user switching to any other user requires password authentication.
Sudo command
Sudo (you need to enter the password of the current user, and the su command requires the password of the root user. Another difference is its default behavior. The sudo command only allows you to run a single command with elevated privileges, while the su command starts a new shell and allows you to run as many commands as possible with root privileges until you explicitly log out.
Su
Su is used to switch to the identity of different users.
By default, you only switch identities, not environment variables, which are still for ordinary users. When switching user identity, the user's environment variable is also switched to the new user's environment variable, so "-" can not be omitted, otherwise some operations cannot be performed.
Su root changes the root user after entering the root password, but the pwd directory remains unchanged.
Su-root changes the root user after entering the root password, but pwd directory / root
Sudo generally adds the command sudo-I root with the same effect as sudo-root, sudo-I, sudo -, and sudo root. When the password is the password of the current account, the user who executes the command must be in sudoers to su. The secret usage of the switched account is "su account name".
Sudo: temporarily switch to superuser mode to perform superuser privileges, which generally refers to the root user. When prompted for a password, the password is the password of the current user, not the password of the superaccount. However, there is a time limit, and Ubuntu defaults to 15 minutes at a time.
Su: switch to the user mode of so-and-so. When prompted for a password, the password is the password of the account after the switch, and the usage is "su account name". If no account is added, the system defaults to the root account, and the password is also the password of the super account. There is no time limit.
Sudo-I: this command can be used to frequently execute certain permissions that only superusers can execute without having to enter a password every time. When prompted for a password, the password is the password of the current account. There is no time limit. After executing the command, the prompt changes to "#" instead of "$". You can execute "exit" or "logout" when you want to return your regular account. The user who is required to execute the command must be in sudoers
Sudo-I runs the sudo command directly with the-I parameter requiring that the user executing the command must be in sudoers
Sudo su runs the sudo command to lift the weight of the su command, and runs the su command. The user who is required to execute the command must be in sudoers.
This is the end of the article on "how to use Linux's su, sudo, sudo su, sudo-I commands". Thank you for reading! I believe you all have a certain understanding of "how to use Linux's su, sudo, sudo su, sudo-I commands". If you want to learn more, you are welcome to follow the industry information channel.
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.