PDA

View Full Version : [ubuntu] [SOLVED] How to see users



jspolen
December 12th, 2008, 01:00 PM
Simple problem I guess but how can I as root see what users are created, in a terminal without looking in the /etc/passwd file?

kpkeerthi
December 12th, 2008, 01:02 PM
ls -ld /home
???

jspolen
December 12th, 2008, 01:05 PM
Well the users I created does not have their own folder

Mucho
December 12th, 2008, 01:36 PM
you can see users on file /etc/group

$view /etc/group

your users will be below groups

Sarmacid
December 12th, 2008, 01:42 PM
It's almost the same as looking at the passwd file, but you can look at the /etc/shadow file.

jspolen
December 12th, 2008, 02:04 PM
Yeah I know, that's where the passwords are located. But I was wondering if there is a command of some sort to list the users. like showusers or something.

spikoley
December 12th, 2008, 02:14 PM
I don't think this is exactly what you are looking for, but these commands show logged in users. It sounds like you are just looking for users on the system.


w

who

finger

bluefrog
December 12th, 2008, 02:16 PM
make your own command.

vi showusers.sh
#!/bin/bash
for i in $(awk 'BEGIN{FS=":"} {if ($3 >= 1000) print $1}' /etc/passwd ); do echo $i; done

chmod u+x showusers.sh
./showusers.sh

you could link it as well into /sbin

sudo ln -s ~/showusers.sh /sbin/showusers

then showusers command is available

jspolen
December 12th, 2008, 06:36 PM
Oh nice idea. Will do that imediatly thanks!