Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-12-2005, 06:15 AM   #1
LQ Newbie
Registered: Oct 2005
Posts: 1

Rep: Reputation: 0
Question Use of LOGNAME for non-unique user ids

The -o option of the useradd command allows multiple user accounts to be registered with the same uid value.

On other Unix systems that I work on (e.g. Tru64), the LOGNAME environment variable can then be used to identify which of the account names was used to login. This enables me to set up a slightly different user profile depending upon the account name (e.g. One for automatic login via a remote tool which sets a default profile and one for manual login which will prompt for the required profile).

When I try this on Linux (uname -r says 2.4.21-27.ELsmp), I discover that the LOGNAME environment variable is always set to the first of the entries in the /etc/passwd file. This appears to be because /etc/profile sets it to the result of running 'id -un'.

Is there any way around this or is this considered to be a security hole that Linux has fixed?

Old 10-13-2005, 12:37 AM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
I'm not sure it's a security hole as much as a "why" type of question.

On the one hand, you want a set of users to be identical by sharing the same ID. In other words, each account name is just an alias for a "shared" account. On the other hand, you want different profiles - you want individuality. Those goals seem to be in direct conflict with each other.

I'm not an experienced admin or anything, but my approach would be to create separate user accounts, that belong to the same group, and set up some sort of shared workspace if that's what you need. They'd need a separate home directory to account for the profile/settings differences, unless you can trust all the users to leave stuff alone. That is, they won't open ~/.bash_profile and start futzing with anything unless it's inside an if-block such as:
if [ "${USER}" = "specific_username" ] ; then
I guess there could be practical/historical reasons you need to have identical user IDs, but it just seems odd.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
create unique user names sabapathys Linux - Software 1 05-12-2005 05:50 AM
create unique user names sabapathys Linux - Newbie 1 05-12-2005 04:09 AM
Linux User IDs ? xwastedmindx Linux - General 2 11-12-2003 07:52 PM
remap? user ids? GATTACA Linux - Networking 3 10-15-2003 01:15 PM
User IDs confuse me. davee Linux - Newbie 1 02-11-2003 05:42 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

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