我可以允许标准用户仅在终端中执行某些命令集吗?
我是否可以创建标准用户可以在Ubuntu 12.04桌面终端中执行的命令白名单?
我不想阻止标准用户的终端。
创建一个新组,比如restricted_group
:
groupadd restricted_group
将用户(您不希望访问某些命令)添加到restricted_group
:
usermod -aG restricted_group restricted_user
使用chgrp
命令将/path_to_directory_with_restricted_commands/restricted_command
组更改为restricted_group
:
chgrp restricted_group /path_to_directory_with_restricted_commands/restricted_command
最后,使用chmod
命令更改文件权限:
chmod 750 /path_to_directory_with_restricted_commands/restricted_command
您还可以将权限应用于目录:
chmod 0640 /path_to_directory_with_restricted_commands
资料来源: http : //www.cyberciti.biz/faq/protect-command-by-configuring-linux-unix-group-permissions/