Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Solaris/SunOS - How to list user accounts

Posted on 2009-02-10
12
Medium Priority
?
6,508 Views
Last Modified: 2013-12-04
Hello

How do you list user accounts in Solaris (SunOS 5.2)?  I am looking everywhere but can't find it.  I would like to list the user accounts on the server and also see their rights (whether they are root or not).

Thanks,
D
0
Comment
Question by:dholbanga
  • 7
  • 5
12 Comments
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23602618
users are listed in /etc/passwd file. The first field of each line is the user name. you may get names by running

awk -F: '{print $1}' /etc/passwd

users are grouped in groups and the fourth field in this file is the group id to which the user belongs

groups are defined in /etc/group file. this file shows the other groups to which the user belongs
0
 

Author Comment

by:dholbanga
ID: 23602656
Thanks!  I did that and got the following output:

$ awk -F: '{print $1}' /etc/passwd
root
daemon
bin
sys
adm
lp
uucp
nuucp
smmsp
listen
nobody
noaccess
nobody4
bb
webservd
test
guest

It doesn't tell me the rights of the accounts though.  It just lists the accounts.  Also, how do you disable or delete an account?
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23602869
only root (user id 0 , the 3rd field in /etc/passwd) is privileged as administrator. users are given permissions over files and directories based on their user ids and groups they belong to. What type of rights are you looking for?

to manage users you may use commands like:

useradd , usermod

http://docs.sun.com/app/docs/doc/806-4073/6jd67r94i?a=view
http://www.kobhi.com/solaris/user_management/solaris_user_management.htm
0
Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23602908
please be careful while dealing with users and do not delete system users (those that come created with the system)
0
 

Author Comment

by:dholbanga
ID: 23604405
Thanks for your help Omar.  I'm trying to see which user has root privileges aside from the root user.  Then I want to lower their privileges if they don't need it.  What's the command for that? I know "usermod" will do it but I am new to this and need some direction.  

Thanks!
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23604608
if the user id is not 0 and not in group id 0 and he is not given rights to run commands as root (e.g. via sudo command, please see http://www.gratisoft.us/sudo/man/sudoers.html) then he is normal user on the system.

from the list of users you found, only bb , test, guest are the users on your system other than the ones that come with the system, hence if they are not given user id 0 and not in group id 0 then I think they are not privileged
0
 

Author Comment

by:dholbanga
ID: 23604934
That's very useful information.  I tried logging in to sudo for root and got the following error:

$ sudo -u root
sudo: not found

So there is something I'm not doing correctly.

Also, how do I check the user ID?  Is there a command for that?  
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 2000 total points
ID: 23604994
use the command

id username

or look into the /etc/passwd file in the 3rd field, e.g.

omar1:x:2005:1::/export/home/omar1:/usr/bin/csh

here user id for omar1 is 2005 and he is in group id 1

0
 

Author Comment

by:dholbanga
ID: 23605248
This is what I get for using that command:

$ id username
id: invalid user name: "username"

So it didn't work :(
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23605299
put actual username e.g. bb

you could do the following also;

awk -F: '{print $1,"\t",$3}' /etc/passwd
0
 

Author Comment

by:dholbanga
ID: 23605350
Yes that worked!!  Thank you so much.  Also, how do you disable an account?  Say I want to disable a user named "guest" how would I do that?
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 2000 total points
ID: 23605458
use

passwd -l guest

this will lock the account, please see:

http://docs.sun.com/app/docs/doc/816-5165/passwd-1?a=view
0

Featured Post

Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As I write this article, I am finishing cleanup from the Qakbot virus variant found in the wild on April 18, 2011.  It was a messy beast that had varying levels of infection, speculated as being dependent on how long it resided on the infected syste…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question