Can I allow a standard user to execute only certain sets of command in terminal? [duplicate]
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/