run a particular method using sudo
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
How to run a single command in rhel for a particular user
e.g: only ls
command should execute, if we try for other commands we should get a error like permission denied
I am uisng visduo file and created a user and assigned a permission like
abhitest ALL=(ALL) /bin/ls
and I tried too abhitest ALL=/bin/ls
but its not working
sudo
add a comment |Â
up vote
0
down vote
favorite
How to run a single command in rhel for a particular user
e.g: only ls
command should execute, if we try for other commands we should get a error like permission denied
I am uisng visduo file and created a user and assigned a permission like
abhitest ALL=(ALL) /bin/ls
and I tried too abhitest ALL=/bin/ls
but its not working
sudo
This would allow userabhitest
to runsudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run thels
command with any parameters as any user, including root. But it would have no effect at all for commands run as userabhitest
: if you want that, you need to set up a restricted shell for that user.
â telcoM
Mar 6 at 10:37
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How to run a single command in rhel for a particular user
e.g: only ls
command should execute, if we try for other commands we should get a error like permission denied
I am uisng visduo file and created a user and assigned a permission like
abhitest ALL=(ALL) /bin/ls
and I tried too abhitest ALL=/bin/ls
but its not working
sudo
How to run a single command in rhel for a particular user
e.g: only ls
command should execute, if we try for other commands we should get a error like permission denied
I am uisng visduo file and created a user and assigned a permission like
abhitest ALL=(ALL) /bin/ls
and I tried too abhitest ALL=/bin/ls
but its not working
sudo
edited Mar 6 at 10:47
Archemar
18.9k93366
18.9k93366
asked Mar 6 at 10:30
Abhinai
1011
1011
This would allow userabhitest
to runsudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run thels
command with any parameters as any user, including root. But it would have no effect at all for commands run as userabhitest
: if you want that, you need to set up a restricted shell for that user.
â telcoM
Mar 6 at 10:37
add a comment |Â
This would allow userabhitest
to runsudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run thels
command with any parameters as any user, including root. But it would have no effect at all for commands run as userabhitest
: if you want that, you need to set up a restricted shell for that user.
â telcoM
Mar 6 at 10:37
This would allow user
abhitest
to run sudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run the ls
command with any parameters as any user, including root. But it would have no effect at all for commands run as user abhitest
: if you want that, you need to set up a restricted shell for that user.â telcoM
Mar 6 at 10:37
This would allow user
abhitest
to run sudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run the ls
command with any parameters as any user, including root. But it would have no effect at all for commands run as user abhitest
: if you want that, you need to set up a restricted shell for that user.â telcoM
Mar 6 at 10:37
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I supposed you refer to sudo mecanism (visudo
is part of sudo
)
with
abhitest ALL=(ALL) /bin/ls
you should be able to run, as abhitest
sudo /bin/ls
- you will be asked
rootabhitest's password. (this may or may not what you intend, assuming a real command)
try ti use in sudoers
abhitest ALL=(ALL) NOPASSWD: /bin/ls /some/secret/dir
you should be able, as abhitest
to run
sudo /bin/ls /some/secret/dir
note that both
sudo ls /some/secret/dir
sudo /bin/ls /some/other/secret/dir
won't "work". In first case ls
is not /bin/ls
, in second case directories are different.
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I supposed you refer to sudo mecanism (visudo
is part of sudo
)
with
abhitest ALL=(ALL) /bin/ls
you should be able to run, as abhitest
sudo /bin/ls
- you will be asked
rootabhitest's password. (this may or may not what you intend, assuming a real command)
try ti use in sudoers
abhitest ALL=(ALL) NOPASSWD: /bin/ls /some/secret/dir
you should be able, as abhitest
to run
sudo /bin/ls /some/secret/dir
note that both
sudo ls /some/secret/dir
sudo /bin/ls /some/other/secret/dir
won't "work". In first case ls
is not /bin/ls
, in second case directories are different.
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
add a comment |Â
up vote
0
down vote
I supposed you refer to sudo mecanism (visudo
is part of sudo
)
with
abhitest ALL=(ALL) /bin/ls
you should be able to run, as abhitest
sudo /bin/ls
- you will be asked
rootabhitest's password. (this may or may not what you intend, assuming a real command)
try ti use in sudoers
abhitest ALL=(ALL) NOPASSWD: /bin/ls /some/secret/dir
you should be able, as abhitest
to run
sudo /bin/ls /some/secret/dir
note that both
sudo ls /some/secret/dir
sudo /bin/ls /some/other/secret/dir
won't "work". In first case ls
is not /bin/ls
, in second case directories are different.
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I supposed you refer to sudo mecanism (visudo
is part of sudo
)
with
abhitest ALL=(ALL) /bin/ls
you should be able to run, as abhitest
sudo /bin/ls
- you will be asked
rootabhitest's password. (this may or may not what you intend, assuming a real command)
try ti use in sudoers
abhitest ALL=(ALL) NOPASSWD: /bin/ls /some/secret/dir
you should be able, as abhitest
to run
sudo /bin/ls /some/secret/dir
note that both
sudo ls /some/secret/dir
sudo /bin/ls /some/other/secret/dir
won't "work". In first case ls
is not /bin/ls
, in second case directories are different.
I supposed you refer to sudo mecanism (visudo
is part of sudo
)
with
abhitest ALL=(ALL) /bin/ls
you should be able to run, as abhitest
sudo /bin/ls
- you will be asked
rootabhitest's password. (this may or may not what you intend, assuming a real command)
try ti use in sudoers
abhitest ALL=(ALL) NOPASSWD: /bin/ls /some/secret/dir
you should be able, as abhitest
to run
sudo /bin/ls /some/secret/dir
note that both
sudo ls /some/secret/dir
sudo /bin/ls /some/other/secret/dir
won't "work". In first case ls
is not /bin/ls
, in second case directories are different.
edited Mar 6 at 11:58
answered Mar 6 at 10:46
Archemar
18.9k93366
18.9k93366
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
add a comment |Â
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
@Kusalananda corrected, thanks.
â Archemar
Mar 6 at 11:58
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%2f428458%2frun-a-particular-method-using-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
This would allow user
abhitest
to runsudo -u <any other user> ls <any parameters>
, i.e. the user would be able to run thels
command with any parameters as any user, including root. But it would have no effect at all for commands run as userabhitest
: if you want that, you need to set up a restricted shell for that user.â telcoM
Mar 6 at 10:37