可以使用 Restricted shell
請參考
shell - How can I restrict the normal user to run only limited set of commands in RHEL? - Unix & Linux Stack Exchange
# cp /bin/bash /bin/rbash
# usermod -s /bin/rbash localuser
/home/localuser/
下創建一個目錄,例如# mkdir /home/localuser/programs
ln -s /bin/cat /home/localuser/programs/
ln -s /bin/exit /home/localuser/programs/
注意: 仍然允許使用全路徑名稱訪問所有命令,因此存在非常有缺陷的問題,只對一般使用者有效