How to find user/login id?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to find user/login id?
# 1  
Old 03-17-2008
How to find user/login id?

It seems like not all Unix have whoami. What is the alterate way to display just the login id?

Any help is appreciated
jak
# 2  
Old 03-17-2008
Most shells have a USER envrionment variable.
Code:
echo $USER

# 3  
Old 03-17-2008
try using id
# 4  
Old 03-17-2008
Thanks .. i will try it out.
# 5  
Old 03-17-2008
FYI, I stumbled upon 'logname' command and it gave me the user id.

Thanks,
jak
# 6  
Old 03-18-2008
if you login as jdoe and then do su - tclark, then echo $USER and logname differ in their output

echo $USER would show tclark while logname would tell you jdoe
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Prevent user from creating new user from his login

Hi Experts, Need your support Redhat 6.5 I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login to perform any task. (10 Replies)
Discussion started by: as7951
10 Replies

2. Shell Programming and Scripting

Login into another user from user inside script

now i have logged in username : ramesh in unix Now i have to created script file to login into another user and have run a command inside that user and after executing the command i have to exit from that user. Inside script, i have to login into su - ram along with password : haihow and have to... (4 Replies)
Discussion started by: rammm
4 Replies

3. AIX

User Account Login Login on your AIX server

I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs. I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Discussion started by: perl_in_my_shel
1 Replies

4. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

5. Shell Programming and Scripting

Want to find the stdout for the partiuclar user login for past 12 hrs.

Want to find the stdout for the partiuclar user login for past 12 hrs. Say for eg : user login id is teladm And the host name is sys22prod I want to see the stdout for that user id in that host for past 12 hrs (1 Reply)
Discussion started by: mail2sant
1 Replies

6. HP-UX

Need to find user login name with their First name and last name

I need to find user login name with their First name and last name .Using HP-UX . i used Finger but couldn't able to get ... $ finger ravi.kumar@domain.com ksh: domain.com: not found i tried with finger kumar ravi finger ravi kumar but not able to get It just giving Login name:... (9 Replies)
Discussion started by: girija
9 Replies

7. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

8. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

9. Shell Programming and Scripting

Running script from other user rather than login user

Hi, My requirement is that i am login from ROOT in a script but when any command is coming which is logging to sqlplus then i have to run it with normal user as only normal user have permission to connect to sqlplus . i tried making a script like this : #! /bin/ksh su -... (3 Replies)
Discussion started by: rawatds
3 Replies

10. UNIX for Dummies Questions & Answers

I create user but i cant login the user i created.

I created a user, i login as a root. I add him in the group where he can access and login as a root! I checked it in users' list and in group's list, he is there. My problem is this, I cant login using the username/account I just created! What should i do to use and login the user/account i've just... (5 Replies)
Discussion started by: jerome
5 Replies
Login or Register to Ask a Question