Sponsored Content
Special Forums Cybersecurity How to diff between 2 users with uid 0? Post 302785075 by Don Cragun on Sunday 24th of March 2013 04:03:14 PM
Old 03-24-2013
When a user logs into a UNIX system, the login name used is saved in a system database and in the environment variable LOGNAME. The file(s) containing the database where it is stored varies from system to system, but is likely to be in a file named something like utmp or utmpx in a directory like /var/run, /var/adm, or /etc. The name stored there should be used by who (not the 1st name in the user database [AKA the passwd file] with a matching UID). The name stored in the login database should also be used by the logname() function and the logname utility (both of which are explicitly NOT allowed to use $LOGNAME since any user can alter the value of $LOGNAME in the current shell execution environment). None of these should care how many different login names are associated with a given user ID.

None of this makes it a good idea to allow multiple user names for any user ID with extended privileges. But, I don't understand why the who or whoami utilities should be unable to determine what login name was used as long as the login session is still active. (They might fail if file descriptors 0, 1, and 2 have been disconnected from the controlling terminal, but they shouldn't make up a login name just based on the UID of the calling process.)
These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies

2. AIX

Locking a file when using VI to prevent multiple-edit sessions by diff users

At the office, we often have to edit one file with VI. We are 4-6 workers doing it and sometimes can be done at the same time. We have found a problem and want to prevent it with a file lock. Is it possible and how ? problem : Worker-a starts edit VI session on File-A at 1PM Worker-b... (14 Replies)
Discussion started by: Browser_ice
14 Replies

3. AIX

Finding a specific UID on a site with hundreads of users.

Hello, I am not the AIX guru.. This might seem simple for a lot but I am not sure where to start.. So here is my question: I have a unix account on a remote site. My UID is 999999. Now I need to create my account at my main site, with the same UID. So i have to make sure the UID 999999 is... (1 Reply)
Discussion started by: maxalarie
1 Replies

4. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

5. OS X (Apple)

When to use /Users/m/bin instead of /usr/local/bin (& whats the diff?)?

Q1. I understand that /usr/local/bin means I can install/uninstall stuff in here and have any chance of messing up my original system files or effecting any other users. I created this directory myself. But what about the directory I didn't create, namely /Users/m/bin? How is that directory... (1 Reply)
Discussion started by: michellepace
1 Replies

6. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

7. Solaris

Can we create multiple users with same UID?

* Can we create multiple users with same UID? * Can we give root permissions to normal user like admin.s ? If YES give me full details (syntax of sudo/RBAC) (14 Replies)
Discussion started by: Navkreddy
14 Replies

8. UNIX for Advanced & Expert Users

How to diff between 2 users with uid 0?

Hello, I created a new user "rootNew" After creation I manually change the file /etc/passwd and gave the new user "rootNew" uid 0. Now I have 2 users with uid 0 (root,rootNew) how can I know which user is log in the system? "whoami" command return "root" for both users. Thanks, Uri No... (0 Replies)
Discussion started by: urip
0 Replies

9. Shell Programming and Scripting

Find users with root UID or GID or root home

I need to list users in /etc/passwd with root's GID or UID or /root as home directory If we have these entries in /etc/passwd root:x:0:0:root:/root:/bin/bash rootgooduser1:x:100:100::/home/gooduser1:/bin/bash baduser1:x:0:300::/home/baduser1:/bin/bash... (6 Replies)
Discussion started by: anil510
6 Replies

10. Homework & Coursework Questions

Display info about users (UID GID processes terminal)

I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made. 1. The problem statement, all variables and given/known data: The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies
LOGIN(1)						    BSD General Commands Manual 						  LOGIN(1)

NAME
login -- log into the computer SYNOPSIS
login [-fp] [-h hostname] [user] DESCRIPTION
The login utility logs users (and pseudo-users) into the computer system. If no user is specified, or if a user is specified and authentication of the user fails, login prompts for a user name. Authentication of users is configurable via pam(8). Password authentication is the default. The following options are available: -f When a user name is specified, this option indicates that proper authentication has already been done and that no password need be requested. This option may only be used by the super-user or when an already logged in user is logging in as themselves. -h Specify the host from which the connection was received. It is used by various daemons such as telnetd(8). This option may only be used by the super-user. -p By default, login discards any previous environment. The -p option disables this behavior. Login access can be controlled via login.access(5) or the login class in login.conf(5), which provides allow and deny records based on time, tty and remote host name. If the file /etc/fbtab exists, login changes the protection and ownership of certain devices specified in this file. Immediately after logging a user in, login displays the system copyright notice, the date and time the user last logged in, the message of the day as well as other information. If the file .hushlogin exists in the user's home directory, all of these messages are suppressed. This is to simplify logins for non-human users, such as uucp(1). The login utility enters information into the environment (see environ(7)) specifying the user's home directory (HOME), command interpreter (SHELL), search path (PATH), terminal type (TERM) and user name (both LOGNAME and USER). Other environment variables may be set due to entries in the login class capabilities database, for the login class assigned in the user's system passwd record. The login class also con- trols the maximum and current process resource limits granted to a login, process priorities and many other aspects of a user's login envi- ronment. Some shells may provide a builtin login command which is similar or identical to this utility. Consult the builtin(1) manual page. The login utility will submit an audit record when login succeeds or fails. Failure to determine the current auditing state will result in an error exit from login. FILES
/etc/fbtab changes device protections /etc/login.conf login class capabilities database /etc/motd message-of-the-day /var/mail/user system mailboxes .hushlogin makes login quieter /etc/pam.d/login pam(8) configuration file /etc/security/audit_user user flags for auditing /etc/security/audit_control global flags for auditing SEE ALSO
builtin(1), chpass(1), csh(1), newgrp(1), passwd(1), rlogin(1), getpass(3), fbtab(5), login.access(5), login.conf(5), environ(7) HISTORY
A login utility appeared in Version 6 AT&T UNIX. BSD
September 13, 2006 BSD
All times are GMT -4. The time now is 09:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy