su

Updated: April 19, 2023

Switch user ID (UNIX)

Syntax:

You must specify the options and arguments in this order:

su [-] [username] [-c command]

Runs on:

QNX Neutrino

Options:

-
If username is preceeded by the - argument, username's login scripts will run, setting up the shell environment as if you had actually logged in as the specified user.
username
Switch to the specified user ID. The default is root.
-c command
Pass the specified command to the invoked shell.

Description:

The su utility lets you temporarily become another user, then return to your regular user ID.

The su utility requests the password of the given username and changes to that username, invoking its shell but modifying only essential elements of the environment. Only the HOME, PATH, and possibly SHELL environment variables are changed, but the new shell has the rights and privileges of the user specified. The new username remains in effect until this shell exits.

Note:
  • This utility needs to have the setuid (“set user ID”) bit set in its permissions. If you use mkefs, mketfs, mkifs, or mkqnx6fs on a Windows host to include this utility in an image, use the perms attribute to specify its permissions explicitly, and the uid and gid attributes to set the ownership correctly.
  • This utility is PAM-aware and supported by the PAM framework. For more information about how QNX Neutrino uses the OpenPAM framework, see “PAM” in the System Security Guide.

Files:

/bin/sh
Korn shell command interpreter.
/dev/null
The bit bucket.
/etc/.pwlock
This file is used to lock password files when modifications are taking place.
/etc/acclog
Logs system accounting information.
/etc/default/profile
The passwd utility copies this file as a user's initial .profile when it creates a new account.
/etc/group
Defines the known groups for the system.
/etc/passwd
Defines the valid user IDs on the system.
/etc/shadow
Contains encoded versions of the actual passwords for user accounts. The passwords themselves aren't stored in the /etc/passwd file.
/usr/adm/sulog
Records all su activity.