E
E
EmachinesDIMA2019-08-21 17:57:11
linux
EmachinesDIMA, 2019-08-21 17:57:11

What needs to be configured to not prescribe sudo for system commands?

Please clarify the following situation: the system command requires sudo even from the superuser. how so?
$ iptables
bash: iptables command not found
$ sudo iptables
-- works
$ su
# whoami
root
#iptables
bash: iptables command not found
# sudo iptables
-- works

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
EmachinesDIMA, 2019-08-21
@EmachinesDIMA

in general, it was necessary to read mana :)
here is a good article - the answer to my question.
https://www.kubuntu.ru/node/10964

R
Ruslan Fedoseev, 2019-08-21
@martin74ua

su
and
su
are different commands.

S
Saboteur, 2019-08-22
@saboteur_kiev

The correct answer is that for sudo with no arguments, the PATH variable is hardcoded
* sudo by default does not use the PATH from your user or from root
* sudo also ignores global variables from /etc/environment or /etc/profile.d/*.sh .
* PATH for sudo is hardcoded to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
If needed make your PATH in sudo, you can either do this: " sudo bash " and already in the open bash set up PATH or other variables.
Or you can write what you need to the global config /etc/profile.d/name_anything.sh using export, and run
For reference, you can read man sudo, look for env_reset

A
AttempGame, 2019-08-28
@AttempGame

sudo su

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question