How to get out of a restricted shell?
One of these commands will be ksh, which means a user running the restricted shell can easily exit out of the restricted shell by simply running ksh to start another shell that will run in normal, full access mode. As described later in this document, additional steps must be taken to further restrict access by a user.
How to start a restricted shell in Bourne?
By using the restricted shell option -r when running the shell command. The Bourne shell can be started as a restricted shell with the command bsh -r, and the Korn shell with the command ksh -r. When a shell is started with the -r option, the shell will enforce restrictions when processing /etc/environment and .profile.
Why does a restricted shell not execute CD?
It will not execute the cd command. It will not allow modification to the following system environment variables; SHELL, ENV, and PATH. It will not allow a program to be executed by specifying a path to the program that includes a / character. This means only commands in the current path can be executed.
How to use a restricted shell-IBM?
Change the default shell for the user to rksh. Create a .profile in the user’s home directory and set the PATH environment variable to a directory containing all of the commands you want the user to be able to run. Create the directory that will contain the commands.
Why is Ctrl-C not allowed in a restricted shell?
It will not return to a shell prompt if it receives an interrupt such as the one generated by Ctrl-C when processing the shell startup files such as /etc/environment and .profile. It should be noted that the restrictions listed above are not enough by themselves to limit access to commands by a user.
Can a restricted shell be run on SSH?
A major problem with restricted shell is that to secure it, you must use .profile or .bashrc to restrict the PATH, disable builtins, etc., but those files are only invoked for interactive shells. If a user uses ssh to run a remote command they are not invoked.