T
T
Tabris172018-11-20 06:31:33
linux
Tabris17, 2018-11-20 06:31:33

Why does sudo ask for a password from the user and not from root?

I installed Linux (Ubuntu), created one user there during installation,
then manually change the root password,
sudo passwd root
now when I use the su command, I ask for the root password,
and when I use the sudo command
, it asks for the user password
UPD: on the contrary, I need to lower the user's rights (deny access to editing system files, installing applications, etc.)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Ruslan Fedoseev, 2018-11-20
@martin74ua

man sudo
before understanding
the sudo command and is intended to not give the user the root password, but still allow some operations to be performed as root.
PS. The fact that everyone usually does "sudo su - " is already the second question). By the way, yes, I recommend studying the difference between
"sudo su" and "sudo su -"

C
CityCat4, 2018-11-20
@CityCat4

No way.
What for? If it's so important - use su.

I
Ingvar, 2018-11-20
@take

if you ask for the root password, why then sudo? After all, this is one of the ways to
hide the root password or disable it altogether)
in general, the sudo (su-du) command can issue limited rights, not full ones, for example, to execute only certain programs "as root". Or to execute certain programs with certain files.
That is, it is not a direct replacement for root

P
pfg21, 2018-11-20
@pfg21

ieh and I'll write my five capes :)
replacing the root password with the user password specifically so as not to shine with the root password.
sudo is a very clever command for granting different levels of rights to users.
access rules are determined by the config.
for example, in this case, you are granted superuser rights because you are a member of the sudo group and there is such an entry in the config

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

there you can write a lot of interesting things, for example, escalation of rights for one specific command / script, i.e. you write a script to perform certain "root" tasks, make it executable for the user, write the necessary access along the way to sudoers.d and voila, the user can execute the script as root. at the same time, he will not be able to do anything other than this sequence of commands - which is good.
I do not advise using root at all, just put an extra space and it will be fun. well, su is less functional.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question