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.
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.
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/