вторник, 5 апреля 2016 г.

The sudo primer

Introduction

To prevent spoiling your system you should avoid usage of dangerous su command. The sudo utility will help you with that. I am going to show you how to install it and perform its initial configuration.

Intallation

To install the sudo utility just run the next command (as super user)
pkg install sudo

Configuration

Using visudo edit the sudoers file. Add the next lines to the according sections

alias of your host


Host_Alias     LOCALHOST     =     fbsd.fbsd.gf4
where LOCALHOST is just host alias (like variable or named constant in programming) and fbsd.fbsd.gf4 is the name of your host (which you set during FreeBSD installation or configuration; you can find the value in the /etc/rc.conf file, under the hostname option)

user group alias

User_Alias     ADMINS     =     vasily
(you can use the whoami command to determine your user name)

enumerate commands to allow

Cmnd_Alias     PACKAGES     =     /usr/sbin/pkg
[use whereis pkg (pkg is just for example) to get the full path to the command you interested in]

specify the privilege

for example
ADMINS     LOCALHOST=(root)     PACKAGES

save changes and exit su

The picture for the example above

Usage

After you install and configure the sudo utility, you will be able to use the privileged commands from your regular user like this
sudo pkg update
First time sudo will show you the next message.

When sudo prompts the password, please type the password of the user you are working as!

Read the next

Install MPlayer and listen to the online radio.

Комментариев нет:

Отправить комментарий