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

How does Linux create a sudo user

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to create a sudo user for Linux. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

The Linux sudo command executes instructions as a system administrator, that is, instructions executed through sudo appear to be executed by root himself.

Brief introduction to sudo commands: to put it simply, sudo is a privilege management mechanism, where administrators can authorize some ordinary users to perform some operations performed by root without knowing the password of root.

Strictly speaking, sudo allows an authorized user to run a command in the role of superuser or other user. Of course, what you can do and what you can't do is specified by security policy.

Sudo supports the security policy of the plug-in architecture and writes input and output to the log.

Third parties can develop and release their own security policy and input / output log plug-ins and make them work seamlessly with sudo.

The default security policy is recorded in the / etc/sudoers file.

How to create a sudo user: 1) Log in to your CentOS server as root:

Ssh root@server_ip_address

2) use the useradd command to create a new user account:

Useradd username

Replace username with the user name you want to create.

3) use the passwd command to set the password for the new user:

Passwd username

Output:

Changing password for user username.New password:Retype new password:passwd: all authentication tokens updated successfully.

4) add new users to group members.

Usermod-aG wheel username

Find the lines in the file that granted sudo access

By default in CentOS, users in the group round are granted sudo access.

How to use sudo

Switch to the newly created user:

Su-username

To use sudo, simply precede the command with sudo and a space.

Sudo ls-l / root

The first time you use sudo in this account, you will see the following header message and you will be prompted to enter the password for the user account.

Output:

We trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things:

# 1) Respect the privacy of others.

# 2) Think before you type.

# 3) With great power comes great responsibility.

[sudo] password for username:

This is enough about how to create a sudo user for Linux. I hope the above content can be of some help to you and learn more. If you think the article is good, you can share it for more people to see.

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

Development

Wechat

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

12
Report