Home > Linux, Red Hat / CentOS > Utföra adminkommandon som användare i CentOS

Utföra adminkommandon som användare i CentOS

You can configuring ‘sudo’ by typing ‘visudo’ to edit the people who can use the sudo command and which commands they can run with sudo.

Some examples :

For example you could say that a user (red15) is allowed to call ‘sudo <any program>’ but he will have to identify himself with a password then :
red15 ALL=(ALL) ALL

Or you could say user (red15) is allowed to execute a program /usr/bin/ls without having to give his password:
red15 ALL=(ALL)NOPASSWD:/usr/bin/ls

Or you could say our user is allowed to run /usr/bin/ls but only as another user (not root for example):
red15 ALL=(other_user)NOPASSWD:/usr/bin/ls

Check out the offical man pages for more info about sudo.

As a side note, try running “su – “. The ” – ” option tells the computer to also load the profile and enviroment variables for the root user, which might be needed by your administration scripts.

Categories: Linux, Red Hat / CentOS Tags:
  1. No comments yet.
  1. No trackbacks yet.