If you want to restrict someone's shell access, use rbash.
chsh -s /bin/rbash username
ref. man bash
RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at
invocation, the shell becomes restricted. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to bash with the exception that the following are
disallowed or not performed:
builtin command
-p option to the hash builtin command
startup
startup
redirection operators
command
to the enable builtin command
builtins
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see COM-
MAND EXECUTION above), rbash turns off any restrictions in the shell
spawned to execute the script.
Leave a comment