Use of sudo command in Ubuntu system

Source: Internet
Author: User
Keywords Ubuntu
Tags access allows users computer configuration editor etc file hard

If a computer needs to be managed by several people at the same time, it's best not to use the root account. Because if everyone uses the same permissions, it's hard to determine who is and where and what. sudo commands are used to solve this problem.

The sudo command allows users defined in the/etc/sudoers configuration file to have temporary permissions to run commands that they cannot run under normal file access permissions. These commands can be run as root or other users defined in the/etc/sudoers configuration file.

If you want to run privileged commands you must add sudo before this command. When you run a command with sudo prefix, the system prompts you to enter your password before executing the command. You can also run other privileged commands in five minutes without having to enter a password. All commands executed in sudo will be recorded in the log file/var/log/messages.

Here are a few simple examples that use sudo.

Temporarily get root user rights

In this example, the user, Bob, tries to browse the directory in the file/etc/sudoers, which requires privileged access. The command failed because sudo was not used:

[Bob@bigboy bob]$ more/etc/sudoers/etc/sudoers:permission Denied[bob@bigboy bob]$

This time Bob used the sudo command and entered his own password, and he succeeded:

[Bob@bigboy bob]$ sudo more/etc/sudoerspassword: ... [Bob@bigboy bob]$

Log on completely as root

The SU command allows a user to be converted to root as long as he knows the root user's password. A user who runs the SU command with sudo privileges can also become the root user, but then they only need to know their own password, not the root password, as you see here.

someuser@u-bigboy:~$ sudo su-password:root@u-bigboy:~#

Some http://www.aliyun.com/zixun/aggregation/13879.html "> The system administrator allows the sudo command to get root permission to operate their own account without having to enter a password.

Download install sudo command pack

Luckily, in Redhat/fedora, the sudo command pack is installed by default and does not need to be installed.

The Visudo command is a text editor that mimics the VI editor, which is used to edit the configuration file/etc/sudoers. We do not recommend you other text editors to modify sudo parameters because the sudoers file does not have the same directory in different versions of Linux. Visudo Command and VI editor, the Visudo command must run as root:

[Root@aqua tmp]# Visudo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.