LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-17-2010, 01:30 AM   #1
manoj.linux
Member
 
Registered: Aug 2007
Posts: 284

Rep: Reputation: 17
Question command to find out users


Hi,

I want to know the command which will list the local users created by me not system users.


Regards,

Manoj
 
Old 05-17-2010, 01:48 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
There is not and cannot be any such command. All the users are listed in the /etc/passwd file but there is no way to determine which are made by you.
 
Old 05-17-2010, 03:46 AM   #3
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
To add on to catkin's response above - useradd is a priveleged command; meaning you either need to be logged in as root or be a sudoer on the machine to be able to add users. Please see a useful set listing of priveleged commands here: http://linux.die.net/man/8/

Therefore by default; all users added are classified as being added by the super user - since any command you run via sudo is considered to have originated by a super user such as root.

What you can achieve is that you do not allow direct root login into a machine; but either:

1. Force users to login using an assigned username with sudoer priveleges
2. Force users to login using a "normal" user first; and then su - (that is login as root).

By doing the above; you'll be able to trace the commands run by different users; and be able to search for users added.

But in summary; catkin is 100% right - Linux is not Windows like; where you can check which user creates other users - the OS is not designed to work in this way.

Cheers
Yas
 
Old 05-17-2010, 04:12 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
In /etc/passwd, each user has a name and a numeric user ID (UID). There are some conventions about the use of UIDs but the only one that is widely observed is that 0-99 are reserved for base system use. Another common but by no means universal convention is that UIDs 100-999 are used for applications UIDs, leaving 1000+ for ordinary users. Commonly user "nobody" has UID 65534 (the largest number available on the original *n*x systems).

The Debian Policy Manual, Chapter 9 - The Operating System, in 9.2.2 "UID and GID classes" describes a UID usage scheme.

What you have on your system depends on what UIDs you set or on the provided defaults.
 
Old 05-17-2010, 06:58 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
On RHEL the default cutoff for non-system users starts at uid 500 http://www.linuxtopia.org/online_boo...l#s2-users-add
 
Old 05-24-2010, 09:09 PM   #6
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,091

Rep: Reputation: 41
awk -F: {if($3>=1000) print $1}' /etc/passwd

replace 1000 where you added users start.. as mentioned above 500 is where it starts on Redhat.
 
Old 05-25-2010, 03:58 PM   #7
orangesky
Member
 
Registered: Jun 2009
Posts: 87

Rep: Reputation: 17
Code:
$cd /home/
$ls
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 05:55 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 04:45 PM
can't find my find command! how to replace? dave247 Debian 4 11-19-2008 10:51 AM
Multiple users with the same name...users command buldir Linux - General 2 08-30-2004 04:34 PM
[FC2]Why does the users command display multiple users? Harkov Fedora 1 07-10-2004 09:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration