Home > Articles > Operating Systems, Server > Solaris

This chapter is from the book

5.5 User Account Commands

Let's explore some common account-oriented commands and functions that users can perform.

Finding Files by Username or Group

This section describes a few ways to find files on a system belonging to a specific user or group.

The -l option of the ls command shows the username and group name associated with files and directories. When ls shows the numeric value for a username or group, this is an indication that the username or group has been removed from the system. The -n option of the ls command shows the numeric userid and groupid.

The find command can be used to locate files on a system belonging to a particular user or group. The syntax of the find command is find directory expression, where directory is the place where find should start searching, and expression is one or more of the following:

  • -user username. Search for files owned by username; username can be the actual username or the numeric userid.

  • -group groupname. Search for files owned by groupname; groupname can be the actual group name or the numeric groupid.

  • -name filename. Search for files named filename.

  • -print. Find will list all files found matching criteria.

  • -exec command {} \;. Execute command with the located file or files as arguments to command.

  • -type x. Find files of type x, where x is one of: f (ordinary file), d (directory), b (block special file), c (character special file), D (door), l (symbolic link), p (named pipe), or s (socket).

Some examples of the find command follow:

# find /export/home –user mark –print
# find /tmp –user 1002 –exec ls –la {} \;
# find /export/tools –group toolmgr –name "*tmp" –exec rm {} \;

In the first example, find will list all files owned by username mark in or below the directory /export/home. In the second example, find will locate all "orphaned" files with userid 1002 in the directory /tmp and perform an ls –la on each located file. In the last example, all files whose names end in "tmp" with groupid toolmgr in or below the directory /export/tools are removed.

Exam Notes

Think About It . . .

What command syntax would be used to change the ownership of "orphaned" files to that of another user? The find and chown commands could be chained together. For example:

find / -user 1002 -print | xargs chown terry

What Users Are Logged In?

who Command

The who command is used to display which users are currently logged into the system. The format of the who command is who [options]. The options for who are:

  • -a. Specify all (-bdlpru) options.
  • -b. Show the system's boot time.
  • -d. Show dead processes.
  • -H. Print a header above output.
  • -l. Show login processes waiting for someone to log in.
  • -n#. Specify the number of users per line for the -q option.
  • -p. Show active processes spawned by init.
  • -q. Show just-logged-in usernames.
  • -r. Show the system run level.
  • -s. Short form of who (no time since last output or pid).
  • -u. Show logged-in users.
  • -m. Show information only about current terminal in -u format.
  • am i. Show information about current terminal (same as -m).

Some examples follow.

# who
root       console      Sep 28 06:13    (:0)
pete       pts/2        Nov  6 05:23    (java)
mark       pts/6        Sep 28 06:13    (acorn)
# who –H
NAME       LINE         TIME
root       console      Sep 28 06:13    (:0)
pete       pts/2        Nov  6 05:23    (java)
mark       pts/6        Sep 28 06:13    (acorn)
# who –q
pete     root     mark
# users=3
# who am i
pete       pts/2        Jan 31 05:24    (java)

In the first example, who shows all logged-in users. The second example includes a heading. The third example shows all logged-in users in quick format.

The last example shows information about the current user. Note that root is running the who am i command, but that the output shows the user pete. The who command displays which users are logged in, but does not reflect whether any users have su'd to other accounts (including root).

The command who am i is frequently confused with a different command, whoami. The answers given by these two commands are essentially the same unless you have su'd from one account to another. In this situation, the who am i command will display the original logged-in username, while whoami will display the effective (su'd) username.

rwho Command

In environments with the in.rwhod feature enabled, the rwho command shows which users are logged in to all systems on the local network. The syntax of the rwho command is rwho [-a], where the -a option will show only active users (those who have typed in commands in the past hour). An example follows.

# rwho
pete     grommit:pts/0 Nov  7 05:48
mark     wallace:pts/2 Nov  6 05:23

In this example, pete is logged into the system grommit, and mark is logged into the system wallace.


At large sites, rwho can create significant amounts of network traffic. This is because all systems running the in.rwhod daemon are frequently broadcasting their status to all other systems on the network. You can see why this feature is disabled by default.

rusers Command

In environments with the rusersd feature enabled, the rusers command shows which users are logged in to another system on the local network. The syntax of the rusers command is rusers [-ahilu] hostlist, where hostlist is a list of one or more host names. The options are:

  • -a. Give a report for a machine even if no users are logged on.
  • -h. Sort alphabetically by host name.
  • -i. Sort by idle time.
  • -l. Give a longer listing in the style of who(1).
  • -u. Sort by number of users.

When the –l option is used, the rusers output resembles that of the who command; the output format is:

userid    hostname:terminal    login date    login time    idle time    login host

Some examples follow.

# rusers -l
Sending broadcast for rusersd protocol version 3...
pete         wallace:pts/2             Jan 31 05:24       7 (java)
gsmith       wallace:pts/3             Jan 31 05:29         (java)
mark         grommit:pts/0             Feb  1 04:04       7 (acorn)
Sending broadcast for rusersd protocol version 2...
# rusers
Sending broadcast for rusersd protocol version 3...
wallace          pete gsmith
grommit          mark
Sending broadcast for rusersd protocol version 2...

In the first example, the rusers -l command lists three users (pete, gsmith, and mark) on two systems (wallace and grommit), in the format resembling that of who. In the second example, the abbreviated rusers output lists the usernames who are logged into each system on the network.

finger Command

The finger command can be used to get information about other users on the system. The syntax of the finger command takes three forms:

finger [-bfhilmpqsw] [username]...
finger [-l] [ username@hostname 1 [ @hostname 2 .. .@hostname n]...]
finger [-l] [ @hostname 1 [ @hostname 2 .. .@hostname n]...]

In the first form, the available options are:

  • -b. Suppress printing the user's home directory and shell in a long format printout.
  • -f. Suppress printing the header that is normally printed in a short format printout.
  • -h. Suppress printing of the .project file in a long format printout.
  • -i. Force "idle" output format, which is similar to short format except that only the login name, terminal, login time, and idle time are printed.
  • -l. Force long output format.
  • -m. Match arguments only on username (not first or last name).
  • -p. Suppress printing of the .plan file in a long format printout.
  • -q. Force quick output format, which is similar to short format except that only the login name, terminal, and login time are printed.
  • -s. Force short output format.
  • -w. Suppress printing the full name in a short format printout.

In the second and third forms, the -l option forces long output format.

Some examples follow.

# finger gsmith
Login name: gsmith                      In real life: Greg Smith
Directory: /export/home/gsmith          Shell: /bin/sh
On since Nov  7 06:18:59 on pts/17 from myclient
No unread mail
No Plan.
# finger -q gsmith
Login      TTY                When
gsmith     pts/3        Wed Jan 31 05:29
# finger mark@grommit
Login       Name               TTY         Idle    When    Where
pete     Mark Foster           pts/0            Thu 04:04  wallace
# finger @wallace
Login       Name               TTY         Idle    When    Where
pete     Peter Gregory         pts/2            Wed 05:24  myclient
gsmith   Greg Smith            pts/3          1 Wed 05:29  myclient
# finger -l @wallace
Login name: pete                        In real life: Peter Gregory
Directory: /export/home/pete            Shell: /bin/sh
On since Jan 31 05:24:14 on pts/2 from myclient
Mail last read Thu Jun 29 04:23:10 2000
No Plan.
Login name: gsmith                      In real life: Greg Smith
Directory: /export/home/gsmith          Shell: /bin/sh
On since Jan 31 05:29:31 on pts/3 from myclient
2 minutes 11 seconds Idle Time
No unread mail
No Plan.

In the first example (finger gsmith), the username gsmith is logged in on the same system that executed the finger command. In the next example (finger –q gsmith), we see information about username gsmith but in quick format. In the third example (finger mark@grommit), we are querying specifically about the username mark on the system grommit. In the fourth example (finger @wallace), we are looking for short-form information about all users logged into the system wallace. In the last example (finger –l @wallace), we see long-form information about users logged into wallace.

In recent years many sites have disabled finger for security reasons. Check with your site administrator to see if this is the case in your organization. If finger is disabled on a system you're trying to reach, you'll get an error message that reads, "[system-name] connect: Connection refused".

Change Password

Root can change any user's account with the passwd command. The format of the passwd command is passwd username options. Allowable options include:

  • -d. Deletes the password. Subsequent logins will not prompt for a password.
  • -f. Forces the user to change passwords at the next login.
  • -l. Locks the account, preventing further logins.
  • -n min. Sets the minimum number of days between password changes.
  • -w warn. Sets the number of days before password expiration that the user is warned about it.
  • -x max. Sets the maximum number of days between password changes.
  • -s username. Displays password attributes for username.
  • -a. Displays password attributes for all users. Use only with the -s option.
  • -h username. Changes the home directory for username.
  • -e username. Changes the login shell for username.
  • -g username. Changes the gcos-field (full name) for username.

Some examples follow.

# passwd –f mark
# passwd –s gsmith
gsmith  PS
# passwd -h gsmith
Default values are printed inside of '[]'.
To accept the default, type <return>.
To have a blank entry, type the word 'none'.
Home Directory [/export/home/gsmith]: /d2/home/gsmith
# passwd –e jhamid
Old shell: /bin/sh
New shell: /bin/csh
$ passwd
passwd:  Changing password for gsmith
Enter login password: *******
passwd(SYSTEM): Sorry: less than 7 days since the last change.
Permission denied
% passwd
passwd:  Changing password for gsmith
Enter login password: ******
New password: ******
Re-enter new password: ******
passwd (SYSTEM): passwd successfully changed for gsmith

In the first example, the account mark is forced to change passwords at the next login. In the second example, the password status for account gsmith is listed. PS means that the account has a password; NP means no password; and LK means the account is locked. In the third example, the home directory for account gsmith is changed to /d2/home/gsmith. In the fourth example, the default shell for jhamid is changed from /bin/sh to /bin/csh. In the fifth example, a user attempts to change his password but is denied because the minimum number of days between password changes has not elapsed. In the last example, a user successfully changes his password.

Password Complexity

The passwd command also checks the "complexity" of the password that the user entered. By complexity we mean that all of the following rules must be met:

  • The length of the password must be at least PASSLENGTH characters, where PASSLENGTH is a variable that is defined in the /etc/default/passwd file. The default value is set to 6. Only the first eight characters are significant.

  • The password must contain at least two lower- or uppercase letters and at least one numeric or special character.

  • The password must be different from the userid and any reverse or circular shift of the userid. Upper- and lowercase letters are considered equal for this test. For example, user gsmith cannot change his password to GSMITH.

  • The new and old passwords must differ by at least three characters. Upper- and lowercase letters are considered equal for this test.

Of the characterics listed, only PASSLENGTH can be changed. All of these characteristics can be bypassed if root is changing the password. This is discussed in the next section.

Root and Password Changes

The root user is permitted to change the password for any user. When root changes a user's password, the passwd command does not prompt for the old password. This permits root to "reset" a user's password in circumstances when the user has forgotten his or her password. This also permits root to lock a user's account by changing the user's password to a value that the user is unlikely to guess.


The password aging and complexity requirements are bypassed when the root user changes a user's password (or when root changes its own password). The danger of this feature is that a system administrator can set poor-quality passwords. Poor passwords are passwords that are short and/or easily guessed.

Exam Notes

Think About It . . .

Why should users change their own passwords?

First, the user will have a greater chance of remembering the password. This will lead to fewer sticky notes with passwords written down. Next, all of the quality rules about passwords (length, complexity, etc.) are enforced when users change their own passwords (no quality checking is performed when root changes a user's password). Finally, over time the user will have a better understanding of the password quality rules.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020