LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Use of LOGNAME for non-unique user ids (https://www.linuxquestions.org/questions/linux-newbie-8/use-of-logname-for-non-unique-user-ids-372210/)

Geoff_Hawke 10-12-2005 06:15 AM

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?

regards
Geoff

Dark_Helmet 10-13-2005 12:37 AM

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:
Code:

if [ "${USER}" = "specific_username" ] ; then
...
fi

I guess there could be practical/historical reasons you need to have identical user IDs, but it just seems odd.


All times are GMT -5. The time now is 02:27 PM.