Re: How to list all users?

From: Davorin Vlahovic (nrubA_at_ylf.krs.ref.rh)
Date: 09/02/04


Date: Thu, 2 Sep 2004 15:30:47 +0200

On 2004-09-02, Lew Pitcher <Lew.Pitcher@td.com> wrote:
> lpitcher@merlin:~$ ls /home | wc -l
> 6
> lpitcher@merlin:~$ wc -l /etc/passwd
> 27 /etc/passwd
> lpitcher@merlin:~$
>
> It appears that there are 24 more users who have accounts on the system than
> there are files/subdirectories of the /home directory.

LOL!!!! :) Tell me, how long have you been using unix? Here:

bin:x:1:1:bin:/bin:
daemon:x:2:2:daemon:/sbin:
adm:x:3:4:adm:/var/log:
lp:x:4:7:lp:/var/spool/lpd:
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/:
news:x:9:13:news:/usr/lib/news:
uucp:x:10:14:uucp:/var/spool/uucppublic:
operator:x:11:0:operator:/root:/bin/bash
games:x:12:100:games:/usr/games:
ftp:x:14:50::/home/ftp:
smmsp:x:25:25:smmsp:/var/spool/clientmqueue:
mysql:x:27:27:MySQL:/var/lib/mysql:/bin/bash
rpc:x:32:32:RPC portmap user:/:/bin/false

This is an excerpt from my /etc/passwd. Tell me how many users are
listed here. You do know what a user is, right?

But, ok, maybe we could go a bit around this...

grep /bin /etc/passwd | grep /home | grep sh

Of course, this still leaves the possibility for a user on the system to
go unnoticed if it hasn't got it's home directory in /home .

> Actually
>
> lpitcher@merlin:~$ ls /home
> ftp/ kernel/ lost+found/ lpitcher/ mpitcher/ puter/
>
> shows me that the /home directory contains the subdirectories of /4/ users,
> not 6 ('lost+found' and 'kernel' are not user subdirectories).

Neither is ftp. I don't know what "puter" is, but I'd guess there are
two users on the machine - lpitcher and mpitcher.

> Lew Pitcher
> IT Consultant, Enterprise Application Architecture,
> Enterprise Technology Solutions, TD Bank Financial Group

So...consultant, eh? :) Well, Mr. Consultant, your signature delimiter
is wrong. :)

-- 
I've found a great way to fight spammers....if you want to find out how, 
mail me at postmaster@localhost ... very very soon, there'll be a reply.
To get my mail just reverse the order. Ie. "ylf" is changed into "fly".


Relevant Pages

  • Re: favorite non-standard app
    ... Second to that would be xine (for my laptop's DVD player). ... Lew Pitcher ... IT Consultant, Enterprise Technology Solutions ...
    (comp.os.linux.misc)
  • Re: Prime number algorithm in C
    ... Lew Pitcher ... IT Consultant, Enterprise Technology Solutions ... Toronto Dominion Bank Financial Group ...
    (comp.programming)
  • Re: help on file name
    ... Lew Pitcher ... IT Consultant, Enterprise Technology Solutions ... Toronto Dominion Bank Financial Group ...
    (comp.unix.admin)
  • Re: implementing kernel32.dll on linux
    ... Lew Pitcher ... IT Consultant, Enterprise Technology Solutions ... Toronto Dominion Bank Financial Group ...
    (comp.os.linux.development.system)
  • Re: Bit operations query on changing case
    ... >>>If I have a character from alphabets and I want to change case of the ... > Lew Pitcher, IT Specialist, Enterprise Data Systems ... > Enterprise Technology Solutions, TD Bank Financial Group ...
    (comp.lang.c)