home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

4.8 Restricted Shells

Restricted shells can be invoked in any of the following ways:


		Korn shell

ksh -r

set -r


	Bourne shell

set -r

Restricted shells can also be set up by supplying the full pathname to rksh or rsh in the shell field of /etc/passwd or by using them as the value for the SHELL variable.

Restricted shells act the same as their nonrestricted counterparts, except that the following are prohibited:

  • Changing directory (i.e., using cd ).

  • Setting the PATH variable. rksh also prohibits setting ENV and SHELL.

  • Specifying a / for command names or pathnames.

  • Redirecting output (i.e., using > and >> ). ksh also prohibits the use of <> .

  • Adding new built-in commands (ksh93 ).

Shell scripts can still be run, since in that case the restricted shell calls ksh or sh to run the script. This includes the /etc/profile , $HOME/.profile , and $ENV files.

Restricted shells are not used much in practice, as they are difficult to set up correctly.

Previous: 4.7 Invoking the Shell UNIX in a Nutshell: System V Edition Next: 4.9 Built-in Commands (Bourne and Korn Shells)
4.7 Invoking the Shell Book Index 4.9 Built-in Commands (Bourne and Korn Shells)

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System