LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-19-2005, 04:45 PM   #1
wardialer
Member
 
Registered: Sep 2004
Distribution: SUSE Linux Pro 9.3
Posts: 375

Rep: Reputation: 30
How could I tell if Im running as ROOT?


Im running Mandrake Linux and I want to know please on how to find out if Im running as root or my regular user account (restricted user).

What is the command to find out?
 
Old 03-19-2005, 04:52 PM   #2
samael26
Member
 
Registered: Oct 2004
Location: France, Provence
Distribution: Debian
Posts: 848

Rep: Reputation: 30
How do you log in ?
Don't you have to type a password to get into your GUI ?
I must say I am amazed at your question ...
 
Old 03-19-2005, 04:53 PM   #3
avarus
Member
 
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
id
 
Old 03-19-2005, 04:57 PM   #4
cylix
Member
 
Registered: Dec 2004
Location: Ohio
Distribution: Fedora Core 3
Posts: 125

Rep: Reputation: 15
whoami
 
Old 03-19-2005, 05:35 PM   #5
avarus
Member
 
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
perl -l -e 'print [getpwuid($<)]->[0]'

or

id -un

...but a simple id is shorter and tells you more!

Better still shove the following into /root/.bashrc and you will get a nice red prompt in your root shell.

if [ "$PS1" ]; then
PS1="\[\033[1;31m\][\u@\h: \w]\\$\[\033[0m\] "
fi

TIM
 
Old 03-19-2005, 06:14 PM   #6
wardialer
Member
 
Registered: Sep 2004
Distribution: SUSE Linux Pro 9.3
Posts: 375

Original Poster
Rep: Reputation: 30
Ok, I did an 'id' command and I only see my username. Which is good.

But, why am I seeing myself 3 times???

My output is this:

uid=501(myusername) gid=501 (myusername) groups=501 (myusername)

How can I resolve this to only showing one??? Why is this showing my username 3 times? Its strange. How can I avoid this?

And the 'whoami' output shows as ONLY myself.... But I do not like the fact that I am seeing myself 3 times...Is this a security issue or problem?

Last edited by wardialer; 03-19-2005 at 06:15 PM.
 
Old 03-19-2005, 06:27 PM   #7
Hidden.Elf
LQ Newbie
 
Registered: Mar 2005
Distribution: ubuntu
Posts: 23

Rep: Reputation: 15
well if you log in with root as your username you are under root... try logging out and then notice what username you use to log in
 
Old 03-19-2005, 07:14 PM   #8
wardialer
Member
 
Registered: Sep 2004
Distribution: SUSE Linux Pro 9.3
Posts: 375

Original Poster
Rep: Reputation: 30
When I login, it shows my username. Thats all...

Bit if I were to login as root, would it say root in the login window?

I just tried testing the Adjust Clock. It shows me that in order to Change the Time, I need to have root access and a password windows opens.

Does this mean Im not working as root???

Last edited by wardialer; 03-19-2005 at 07:16 PM.
 
Old 03-19-2005, 07:28 PM   #9
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Yes. The "id" command showed you your user name 3 times because it's showing you three different things, your user account, your current primary hroup, and the list of all groups you are in. Your user id is 501, which corresponds to "myusername". Your primary group is also 501 which is called "myusername" (in Mandrake as in Red Hat, the default is to make each user a member of a group of the same name), and that is the only group you are a member of.

Hope this clears some things up.
 
Old 03-19-2005, 09:47 PM   #10
wardialer
Member
 
Registered: Sep 2004
Distribution: SUSE Linux Pro 9.3
Posts: 375

Original Poster
Rep: Reputation: 30
Thanks, just wanna make extra sure.

But anyhow... I guess Im not running as root. Because I tried to change the system time, and it asked me for the root password.

Btmiller -

Just noticed your setup there. Quite nice. I wish I was running OpenBSD.

Last edited by wardialer; 03-19-2005 at 09:49 PM.
 
  


Reply


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
running rsync as root msound Linux - Security 4 11-09-2005 10:16 AM
Am I running as ROOT? wardialer Linux - Security 3 04-25-2005 01:31 PM
running programs from root oscarp Linux - Software 2 09-17-2004 08:08 AM
running as root murray_linux Slackware 4 11-11-2003 07:30 PM
installed as root, running as non-root? daniela Linux - Newbie 4 09-09-2003 04:41 PM

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

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