LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-08-2010, 11:12 PM   #1
ahmadzz
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
How to prevent duplicate UIDs?


I have been learning Linux for the past few months and just recently started with Bash programming.

Using scripts it is possible to find users with duplicate UIDs but is there any way or script why which duplicate UIDs can be prevented altogether.
 
Old 10-08-2010, 11:20 PM   #2
jcomeau_ictx
LQ Newbie
 
Registered: Aug 2004
Location: Petaluma, CA, US
Distribution: Debian GNU/Linux squeeze/sid
Posts: 29

Rep: Reputation: 17
Quote:
Originally Posted by ahmadzz View Post
I have been learning Linux for the past few months and just recently started with Bash programming.

Using scripts it is possible to find users with duplicate UIDs but is there any way or script why which duplicate UIDs can be prevented altogether.
Using the command-line utility 'adduser' you will avoid duplicate UIDs. In fact, even the lower-level 'useradd' should avoid it. Someone on your system may have used 'vipw' or otherwise manually edited /etc/passwd and associated files.
 
Old 10-10-2010, 03:47 AM   #3
ahmadzz
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the reply but my question is from a System Administrator's point of view. Securing (Hardening) Linux.

Is there a way to prevent duplicate IDs? A system level policy
 
Old 10-10-2010, 09:22 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
How about an administrators' policy not to add users except using the tools that already implement it (and not to use useradd's override!)?
 
Old 10-10-2010, 01:18 PM   #5
jcomeau_ictx
LQ Newbie
 
Registered: Aug 2004
Location: Petaluma, CA, US
Distribution: Debian GNU/Linux squeeze/sid
Posts: 29

Rep: Reputation: 17
Quote:
Originally Posted by ahmadzz View Post
Thanks for the reply but my question is from a System Administrator's point of view. Securing (Hardening) Linux.

Is there a way to prevent duplicate IDs? A system level policy
I'm wondering from what perspective you took my answer to be. Only administrators have access to those tools, and those tools, using their defaults, do indeed enforce that policy.
 
Old 10-10-2010, 01:28 PM   #6
jcomeau_ictx
LQ Newbie
 
Registered: Aug 2004
Location: Petaluma, CA, US
Distribution: Debian GNU/Linux squeeze/sid
Posts: 29

Rep: Reputation: 17
Quote:
Originally Posted by jcomeau_ictx View Post
I'm wondering from what perspective you took my answer to be. Only administrators have access to those tools, and those tools, using their defaults, do indeed enforce that policy.
Ah, shouldn't have posted so soon. I guess what you're asking is "is there a way to prevent myself from shooting myself in the foot"?

Just off the top of my head, implementing /etc/passwd and /etc/shadow as symlinks to dynamic "files" implemented by a user filesystem (FUSE) could possibly work, at a tremendous cost in added complexity and possibility of subterfuge. Let's say you implemented it using some type of database, with the UID being a primary key; an administrator could remove the primary key attribute from the field, and you'd be back with the original problem.

Some problems are better solved by policy rather than technology. Of course, you could put /etc and anything else you want unchangeable on DVD or other write-once media, but then any time you wanted to change something you'd have to burn a new disk.
 
Old 10-10-2010, 08:02 PM   #7
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
As stated, the system tools already prevent this. What is the problem?
 
Old 10-10-2010, 09:55 PM   #8
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
To answer your question:
"is there any way or script why which duplicate UIDs can be prevented altogether."

The answer would be no.

Root can log in and edit passwd manually, and add a user with an existing UID.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 04:43 PM
OOo and problem with UIDs... marekjs Linux - Software 3 04-21-2006 11:25 PM
two users with uids of 0 shanenin Linux - Security 2 03-04-2005 09:57 AM
Multiple UIDS at the same time ? SiLiCoN Linux - General 3 12-17-2004 04:20 AM
Help with UIDs please :) gponto18 Linux - Newbie 5 10-22-2002 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:17 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