Can I allow a standard user to execute only certain sets of command in terminal?

6,405

Create a new group, let say restricted_group:

groupadd restricted_group

Add the user (that you don't wish to to have access some commands) to restricted_group:

usermod -aG restricted_group restricted_user

Use the chgrp command to change the group of /path_to_directory_with_restricted_commands/restricted_command to restricted_group:

chgrp restricted_group /path_to_directory_with_restricted_commands/restricted_command

Finally, use the chmod command to change file permission:

chmod 750 /path_to_directory_with_restricted_commands/restricted_command

You can also apply permissions to directory:

chmod 0640 /path_to_directory_with_restricted_commands

Source: http://www.cyberciti.biz/faq/protect-command-by-configuring-linux-unix-group-permissions/

Share:
6,405

Related videos on Youtube

rishab v
Author by

rishab v

Updated on September 18, 2022

Comments

  • rishab v
    rishab v over 1 year

    Can I create a whitelist of commands that a standard user can execute in the terminal in Ubuntu 12.04 desktop?

    I don't want to block the terminal for the standard user.

    • Admin
      Admin almost 11 years
      PLEASE START MARKING ANSWERS AS "ACCEPTED" IF INDEED THEY DO ANSWER YOUR QUERY.
    • Warren Hill
      Warren Hill almost 11 years
      Can you give us examples of the commands you want to whitelist or blacklist? Most commands which can have a significant effect on the system can only be run by root or an administrator.
    • Eric Carvalho
      Eric Carvalho almost 11 years
      rishab, you got answers for many questions you made but you didn't marked any one as "accepted". If an answer helps you, upvote it. If an answer "works for you" mark it as accepted by clicking the checkmark next to it. Please take the Ask Ubuntu tour.
    • Panther
      Panther almost 11 years
      This is the essentially the same as your other question, see the answer I posted.