passwd
Change the login password or create new user names (UNIX)
Syntax:
passwd [-delSu] [-i inactive] [-n mindays][-w warndays] [-x maxdays] [username]
Runs on:
QNX OS
Options:
- d
- Delete a user's password.
- e
- Expire an account's password. Force a password change on the next login.
- i inactive
- Disable an account after password has been expired for inactive days. After an account is disabled, the user can't log in.
- l
- Lock the password for the specified account.
- n mindays
- Set the minimum days between password changes to mindays. Use a value of 0 to indicate that the password may be changed at any time.
- S
- Display account status information as follows: username status date mindays maxdays warndays inactive where status is one of NP (no password), L (locked password), P (usable password) and date is formatted according to ISO-8601.
- u
- Unlock the password for the specified account.
- w warndays
- Warn users for this many days before a password change is required. A value of 0 in this field indicates that the user is never warned that a password change is required.
- x maxdays
- The maximum number of days that a password remains valid. A value of 0 in this field indicates that the password remains valid indefinitely.
- username
- The username whose password is to be changed or for whom an account is to be created (root only).
Description:
You can use the passwd utility to change your login password, and if you're logged in as the superuser (root), you can create a new user account.
If you're changing your password, passwd prompts for the old password and then for the new password. The new password must be entered twice, to avoid typing mistakes. Only the owner or the superuser may change a password.
passwd new_user_name
When creating a new user account, passwd prompts
for information, such as the user's group list, home directory, and shell.
The /etc/default/passwd file (see
Files,
below) specifies the default values for these prompts.
You can edit this file to modify
passwd's behavior to suit local requirements.
PAMin the System Security Guide.
Files:
- /etc/.pwlock
- This file is created by passwd to indicate to other instances
of passwd that the password file is currently being modified.
When passwd finishes, the file is removed. See
Caveats,
below. - /etc/group
- This file defines the known groups for the system. It associates
group names with a numerical ID and a list of
usernames who are members of the group.
Entries in this file appear in the following format:
groupname:x:groupid:user[,user]...
The
x
represents the group password; QNX OS doesn't support group passwords.For more information, see /etc/group in the QNX OS User's Guide.
- /etc/passwd
- Contains the user account entries. The format of entries in this file are as follows:
username:has_passwd:userid:groupid:misc:home_directory:initial_command
For more information, see /etc/passwd in the QNX OS User's Guide.
- /etc/shadow
- Contains encoded versions of the actual passwords for user accounts.
The passwords themselves aren't stored in the /etc/passwd file.
For more information, see /etc/shadow in the QNX OS User's Guide.
- /etc/opasswd, /etc/oshadow
- When passwd modifies a password file, it first locks the
password files with the /etc/.pwlock file, then copies
the contents of the current /etc/passwd and /etc/shadow
files to /etc/opasswd and /etc/oshadow,
respectively. If passwd is killed before it finishes writing
the updated file, the password files may be restored from these backup
versions. See
Caveats,
below. - /etc/default/passwd
- Specifies the settings that the passwd utility uses when you create a new
user account. If you're the system administrator, you can edit this file. The settings
include the following, shown with the value specified by default in this file:
Setting Default Description BASEDIR=dirname
/usr The base directory under which user directories are created. SHELL=progname
/bin/sh The shell to use for the login shell field in new password entries. UIDRANGE=low-[high]
100-30000
The valid range of values for new user IDs. You can omit the high component, indicating no upper bound, but you still need the dash. Valid values include the low value but the high value is excluded. GIDRANGE=low-[high]
1-30000
The valid range of values for group IDs. As with UIDRANGE
, you can omit the high component if there's no upper bound. Valid values include the low value but the high value is excluded.DUPDIROK
Not set If specified, passwd lets you select an existing directory as a new user's home directory. DUPUIDOK
Not set If specified, passwd lets you select an existing user ID for a new username. This is generally discouraged, because it allows many usernames to be mapped to one user ID. PROFILE=
basename.profile The name to use for the shell's initialization file in the user's home directory. The file specified by DEFPROFILE
(below) is copied there when you set up a new account.DEFPROFILE=
filename/etc/default/profile The path to a default shell-initialization file that's copied to a new user's PROFILE
when you set up the account.
Caveats:
The passwd utility creates the /etc/.pwlock file during updates to the password database. If for some reason the system crashes at an inopportune moment and leaves this file present, passwd refuses to work until the file is removed by the system administrator. If the password files are somehow left in an inconsistent state as a result of the crash, the system administrator should also copy /etc/oshadow to /etc/shadow and copy /etc/opasswd to /etc/passwd.