'\" te .\" Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. .\" Copyright 1989 AT&T. .TH rsh 1M "21 Sep 2015" "SunOS 5.11" "System Administration Commands" .SH NAME rsh, restricted_shell \- restricted shell command interpreter .SH SYNOPSIS .LP .nf \fB/usr/lib/rsh\fR [\fB-acefhiknprstuvx\fR] [\fIargument\fR]... .fi .SH DESCRIPTION .sp .LP \fBrsh\fR is a limiting version of the standard command interpreter \fBsh\fR, used to restrict logins to execution environments whose capabilities are more controlled than those of \fBsh\fR (see \fBksh93\fR(1) for complete description and usage). The command interpreter \fBsh\fR refers to \fBksh93\fR and not the Bourne shell. \fB/usr/bin/sh\fR is a link to ksh93. .sp .LP When the shell is invoked, it scans the environment for the value of the environmental variable, \fBSHELL\fR. If it is found and \fBrsh\fR is the file name part of its value, the shell becomes a restricted shell. .sp .LP The actions of \fBrsh\fR are identical to those of \fBsh\fR, except that the following are disallowed: .RS +4 .TP .ie t \(bu .el o changing directory (see \fBcd\fR(1)), .RE .RS +4 .TP .ie t \(bu .el o setting the value of $\fBPATH\fR, .RE .RS +4 .TP .ie t \(bu .el o pecifying path or command names containing \fB/\fR, .RE .RS +4 .TP .ie t \(bu .el o redirecting output (\fB>\fR and \fB>>\fR). .RE .sp .LP The restrictions above are enforced after \fI\&.profile\fR is interpreted. .sp .LP A restricted shell can be invoked in one of the following ways: .RS +4 .TP 1. \fBrsh\fR is the file name part of the last entry in the \fB/etc/passwd\fR file (see \fBpasswd\fR(4)); .RE .RS +4 .TP 2. the environment variable \fBSHELL\fR exists and \fBrsh\fR is the file name part of its value; the environment variable \fBSHELL\fR needs to be set in the \fB\&.login\fR file; .RE .RS +4 .TP 3. the shell is invoked and \fBrsh\fR is the file name part of argument 0; .RE .RS +4 .TP 4. the shell is invoke with the \fB-r\fR option. .RE .sp .LP When a command to be executed is found to be a shell procedure, \fBrsh\fR invokes \fBsh\fR to execute it. Thus, it is possible to provide to the end-user shell procedures that have access to the full power of the standard shell, while imposing a limited menu of commands; this scheme assumes that the end-user does not have write and execute permissions in the same directory. .sp .LP The net effect of these rules is that the writer of the \fI\&.profile\fR (see \fBprofile\fR(4)) has complete control over user actions by performing guaranteed setup actions and leaving the user in an appropriate directory (probably \fInot\fR the login directory). .sp .LP The system administrator often sets up a directory of commands (that is, \fB/usr/rbin\fR) that can be safely invoked by a restricted shell. Some systems also provide a restricted editor, \fBred\fR. .SH EXIT STATUS .sp .LP Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status. If the shell is being used non-interactively execution of the shell file is abandoned. Otherwise, the shell returns the exit status of the last command executed. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os .TE .SH SEE ALSO .sp .LP \fBIntro\fR(1), \fBcd\fR(1), \fBlogin\fR(1), \fBrsh\fR(1), \fBsh\fR(1), \fBksh93\fR(1), \fBexec\fR(2), \fBpasswd\fR(4), \fBprofile\fR(4), \fBattributes\fR(5) .SH NOTES .sp .LP The restricted shell, \fB/usr/lib/rsh\fR, should not be confused with the remote shell, \fB/usr/bin/rsh\fR, which is documented in \fBrsh\fR(1).