Command not found when run as sudo
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm running centos7. I installed puppet. if I write puppet
as a user, I get a proper output. If I write sudo puppet
I get command not found
.
The really weird thing is, if I do sudo su -
and become root, then write puppet
, I get the normal output that I get when I run it with the normal user...
[unu@centosmaster puppet]$ puppet
See 'puppet help' for help on available puppet subcommands
[unu@centosmaster puppet]$ sudo puppet
sudo: puppet: command not found
[unu@centosmaster puppet]$ sudo su -
Last login: Wed Sep 19 08:41:20 EDT 2018 on pts/0
[root@centosmaster ~]# puppet
See 'puppet help' for help on available puppet subcommands
This, to me, makes absolutely no sense...
The $PATH
variable is the same for root and normal user.
sudo path puppet
add a comment |Â
up vote
2
down vote
favorite
I'm running centos7. I installed puppet. if I write puppet
as a user, I get a proper output. If I write sudo puppet
I get command not found
.
The really weird thing is, if I do sudo su -
and become root, then write puppet
, I get the normal output that I get when I run it with the normal user...
[unu@centosmaster puppet]$ puppet
See 'puppet help' for help on available puppet subcommands
[unu@centosmaster puppet]$ sudo puppet
sudo: puppet: command not found
[unu@centosmaster puppet]$ sudo su -
Last login: Wed Sep 19 08:41:20 EDT 2018 on pts/0
[root@centosmaster ~]# puppet
See 'puppet help' for help on available puppet subcommands
This, to me, makes absolutely no sense...
The $PATH
variable is the same for root and normal user.
sudo path puppet
There's no point in usingsudo su -
. Either just usesu -
or, if you don't have the root password, usesudo -i
.
â terdonâ¦
Sep 19 at 14:38
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm running centos7. I installed puppet. if I write puppet
as a user, I get a proper output. If I write sudo puppet
I get command not found
.
The really weird thing is, if I do sudo su -
and become root, then write puppet
, I get the normal output that I get when I run it with the normal user...
[unu@centosmaster puppet]$ puppet
See 'puppet help' for help on available puppet subcommands
[unu@centosmaster puppet]$ sudo puppet
sudo: puppet: command not found
[unu@centosmaster puppet]$ sudo su -
Last login: Wed Sep 19 08:41:20 EDT 2018 on pts/0
[root@centosmaster ~]# puppet
See 'puppet help' for help on available puppet subcommands
This, to me, makes absolutely no sense...
The $PATH
variable is the same for root and normal user.
sudo path puppet
I'm running centos7. I installed puppet. if I write puppet
as a user, I get a proper output. If I write sudo puppet
I get command not found
.
The really weird thing is, if I do sudo su -
and become root, then write puppet
, I get the normal output that I get when I run it with the normal user...
[unu@centosmaster puppet]$ puppet
See 'puppet help' for help on available puppet subcommands
[unu@centosmaster puppet]$ sudo puppet
sudo: puppet: command not found
[unu@centosmaster puppet]$ sudo su -
Last login: Wed Sep 19 08:41:20 EDT 2018 on pts/0
[root@centosmaster ~]# puppet
See 'puppet help' for help on available puppet subcommands
This, to me, makes absolutely no sense...
The $PATH
variable is the same for root and normal user.
sudo path puppet
sudo path puppet
asked Sep 19 at 13:19
iamAguest
985
985
There's no point in usingsudo su -
. Either just usesu -
or, if you don't have the root password, usesudo -i
.
â terdonâ¦
Sep 19 at 14:38
add a comment |Â
There's no point in usingsudo su -
. Either just usesu -
or, if you don't have the root password, usesudo -i
.
â terdonâ¦
Sep 19 at 14:38
There's no point in using
sudo su -
. Either just use su -
or, if you don't have the root password, use sudo -i
.â terdonâ¦
Sep 19 at 14:38
There's no point in using
sudo su -
. Either just use su -
or, if you don't have the root password, use sudo -i
.â terdonâ¦
Sep 19 at 14:38
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.
That's why some commands won't work with sudo
.
Looks like you should check in /etc/sudoers
(edit it with visudo
!!) for these options:
Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these
This line:
Defaults secure_path = "some path"
specifically overrides your user's $PATH
with a predetermined one which
evidently differs from what you're expecting.
You might want to modify secure_path
to your needs, or just comment the whole line if you feel your standard user's $PATH
should be used even with sudo [command]
.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.
That's why some commands won't work with sudo
.
Looks like you should check in /etc/sudoers
(edit it with visudo
!!) for these options:
Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these
This line:
Defaults secure_path = "some path"
specifically overrides your user's $PATH
with a predetermined one which
evidently differs from what you're expecting.
You might want to modify secure_path
to your needs, or just comment the whole line if you feel your standard user's $PATH
should be used even with sudo [command]
.
add a comment |Â
up vote
2
down vote
accepted
According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.
That's why some commands won't work with sudo
.
Looks like you should check in /etc/sudoers
(edit it with visudo
!!) for these options:
Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these
This line:
Defaults secure_path = "some path"
specifically overrides your user's $PATH
with a predetermined one which
evidently differs from what you're expecting.
You might want to modify secure_path
to your needs, or just comment the whole line if you feel your standard user's $PATH
should be used even with sudo [command]
.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.
That's why some commands won't work with sudo
.
Looks like you should check in /etc/sudoers
(edit it with visudo
!!) for these options:
Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these
This line:
Defaults secure_path = "some path"
specifically overrides your user's $PATH
with a predetermined one which
evidently differs from what you're expecting.
You might want to modify secure_path
to your needs, or just comment the whole line if you feel your standard user's $PATH
should be used even with sudo [command]
.
According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.
That's why some commands won't work with sudo
.
Looks like you should check in /etc/sudoers
(edit it with visudo
!!) for these options:
Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these
This line:
Defaults secure_path = "some path"
specifically overrides your user's $PATH
with a predetermined one which
evidently differs from what you're expecting.
You might want to modify secure_path
to your needs, or just comment the whole line if you feel your standard user's $PATH
should be used even with sudo [command]
.
answered Sep 19 at 13:28
Mr Shunz
2,76811720
2,76811720
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470015%2fcommand-not-found-when-run-as-sudo%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
There's no point in using
sudo su -
. Either just usesu -
or, if you don't have the root password, usesudo -i
.â terdonâ¦
Sep 19 at 14:38