16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Options<br />

Examples<br />

Usage notes<br />

To restore the previous session, enter exit or press (where EscChar<br />

is normally the cent sign). If you use rlogin or telnet to enter the shell, you hold<br />

down the Ctrl key while you press D. This action ends the child shell initiated by the<br />

su command and returns you to the previous shell, user ID, and environment. See<br />

z/<strong>OS</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> User’s Guide for more information about exiting the<br />

shell environment.<br />

– Start the new shell as a login shell. Set the shell variables SHELL, HOME,<br />

and LOGNAME according to the new user’s profile, and prepend a ’–’ to the<br />

shell name to indicate that the shell should read its login profiles.<br />

–s Does not prompt for password. If a user ID is specified, you must have read<br />

access to the SURROGAT class profile, BPX.SRV.uuuuuuuu (where<br />

uuuuuuuu is the MVS userid associated with the target UID).<br />

To switch to admin user ID, but maintain the current user’s shell environment:<br />

su admin<br />

To authorize a user to switch to another user without entering a password, grant<br />

them RACF SURROGAT authority:<br />

RDEFINE SURROGAT BPX.SRV.ADMIN UACC(NONE)<br />

PERMIT BPX.SRV.ADMIN CLASS(SURROGAT) ID(FRED) ACCESS(READ)<br />

SETROPTS RACLIST(SURROGAT) REFRESH<br />

Then, from Fred, issue:<br />

su -s admin<br />

To start a child shell with the login environment of the admin user ID:<br />

su - admin<br />

To run the /usr/lib/backupall script under the admin user ID (and return to the parent<br />

shell environment when the script completes):<br />

su admin /usr/lib/backupall<br />

To run a remove shell command under the admin user ID (and return to the parent<br />

shell environment when the command completes):<br />

su admin -c "rm -rf /tmp/"<br />

1. The new shell inherits the standard file descriptors from the su command, so<br />

commands can be piped to the stdin of the new shell and run under the new<br />

user.<br />

2. If the OMVS NOECHO option is in effect, your password will be displayed.<br />

3. Because su starts a new interactive shell, it should not be used from a batch<br />

interface such as BPXBATCH, unless you provide the commands to be<br />

executed under superuser via stdin to the su command.<br />

4. After issuing su -s in the shell to switch to another user, the new user will not<br />

have the authority to issue any commands that require an implicit open() of a<br />

tty. This restriction includes calls which invoke the Binder (such as cp -X and<br />

c89) as well as explicit attempts at opening a file descriptor (such as cat<br />

/dev/fd2). An ICH408I message is written to the console to alert the user of the<br />

access violation.<br />

su<br />

Chapter 2. Shell command descriptions 609

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!