0

Is it possible to see which users currently exist in ubuntu server 12.04 in login prompt without authentication? In command prompt, is such thing possible?

Shnkc
  • 101

1 Answers1

1

It is not possible to do this without actually logging in. The method to do that is with the package pam_motd (it will already be installed on your system).

When logging into an Ubuntu server you may have noticed the informative Message Of The Day (MOTD). This information is obtained and displayed using a couple of packages:

pam_motd executes the scripts in /etc/update-motd.d in order based on the number prepended to the script. The output of the scripts is written to /var/run/motd, keeping the numerical order, then concatenated with /etc/motd.tail.

Create /usr/local/bin/whoisloggedin, a simple shell script to show who:

#!/bin/sh
#
#
# Prints who is logged in for the MOTD.
#
#
echo
who
echo

Make the script executable:

sudo chmod 755 /usr/local/bin/whoisloggedin

Next, create a symlink to /etc/update-motd.d/98-whoisloggedin:

sudo ln -s /usr/local/bin/whoisloggedin /etc/update-motd.d/98-whoisloggedin

Finally, exit the server and re-login to view the new MOTD.

Rinzwind
  • 309,379