You are on page 1of 5

Users and Groups - OTN Solaris-Unix Command Comparison - Oracle Wiki

1 de 5

https://wikis.oracle.com/display/OTNTaskFinder/Users+and+Groups

Users and Groups


Added by szorn, last edited by ghenningsen on Aug 19, 2010

Task jumplist
Users
Groups

Users
Task

Oracle Solaris 10

Oracle Enterprise Linux 5

GUI tools

Solaris Management Console


smc &
references: smc(1M)

from GNOME desktop menu, select "System -> Administration


-> Users and Groups" or run:
system-config-users &

adds new user (local /etc filesystem only; does not update NIS/NIS+):
useradd -d /export/home/joe -m -s /bin/ksh -c "Joe

add a new user:


useradd -d /export/home/user1 -m -s /bin/ksh

User" joe

-c "New User" user1

add user (updates NIS/NIS+ name service or local /etc filesystem):


smuser add -H myhost -p mypasswd -u root -- -F "Joe

reference: useradd(8)

add a user

Smith" -n user1 -c "Joe's account"


references: useradd(1M), smuser(1M)
remove a user

remove an existing user login account (but leave home directory):


userdel user1
smuser delete -n user1

remove an existing user login account (but leave home


directory):
userdel user1

remove an existing user's login account and home directory:


userdel -r user1

remove an existing user's login account and home directory:


userdel -r user1

references: userdel(1M), smuser(1M)

reference: userdel(8)

16/08/2012 08:29 AM

Users and Groups - OTN Solaris-Unix Command Comparison - Oracle Wiki

2 de 5

change a user's group


information

https://wikis.oracle.com/display/OTNTaskFinder/Users+and+Groups

change a user's primary group membership:


usermod -g mygroup1 user1

change a user's primary group membership:


usermod -g mygroup1 user1

change a user's supplemental group membership:


usermod -G mygroup2,mygroup3,mygroup4 user1

change a user's supplemental group membership:


usermod -G mygroup2,mygroup3,mygroup4 user1

change a user's group during a login session


newgrp mygroup

change a user's group during a login session


newgrp mygroup

reference: usermod(1M), newgrp(1)

add a user to a group:


gpasswd -a user1,user2 mygroup
reference: usermod(8), newgrp(1), gpasswd(8)

change a user's password

passwd user1

passwd user1

reference: passwd(1)

change many users' passwords at one time:


chpasswd <enter>
user1:passwd1 <enter>
user2:passwd2 <enter>
<cntl> D
Note: chpasswd requires clear-text password
reference: passwd(1), chpasswd(8)

change a user's password


aging information

set a 30 day expiration period, with a 10 day warning period:


passwd -x 30 -w 10 user1

set a 30 day expiration period, with a 10 day warning period:


chage -M 30 -W 10 user1

turn off password aging, let user keep their current password:
passwd -x -1 user1

turn off password aging:


chage -M -1 user1

force user to change password at next login, and then turn off aging
passwd -x 0 user1

reference: chage(1)

reference: passwd(1), Administering Passwords


display user information

display a user's entry from passwd database:


getent passwd user1

getent passwd user1


reference: getent(1)

displays extended info for a user:


logins -x -l user1

16/08/2012 08:29 AM

Users and Groups - OTN Solaris-Unix Command Comparison - Oracle Wiki

3 de 5

https://wikis.oracle.com/display/OTNTaskFinder/Users+and+Groups

references: getent(1M), logins(1M)


allow/deny root logins

/etc/default/login

/etc/securetty

/etc/ssh/sshd_config

/etc/ssh/sshd_config
reference: sshd_config(5), securetty(5)

references: sshd_config(4), login(1)


default user files

/etc/default/login

/etc/profile

/etc/profile

/etc/security/*

/etc/security/*

/etc/skel

reference: login(1) Files

/etc/profile.d/*

Groups
Task

Oracle Solaris 10

Oracle Enterprise Linux

GUI tools

Solaris Management Console


smc &

from GNOME desktop menu, select "System -> Administration


-> Users and Groups" or run:
system-config-users &

references: smc(1M)
add a group

add a group using next available group number (local /etc filesystem
only; does not update NIS/NIS+):
groupadd mynewgroup
add a group (updates NIS/NIS+ name service or local /etc filesystem):
smgroup add -- -n mynewgroup

remove a group

groupadd mynewgroup
create a new group using force flag; exit if the group to be
added already exists:
groupadd -f mynewgroup

references: groupadd(1M), smgroup(1M)

reference: groupadd(8)

for /etc filesystem only (does not update NIS/NIS+); remove the
specified group:
groupdel mynewgroup

groupdel mynewgroup
reference: groupdel(8)

for NIS/NIS+ or local /etc filesystem; remove the specified group:


smgroup delete -- -n mygroup
references:smgroup(1M), groupdel(1M)
rename a group

for local /etc filesystem only; renames the existing group "mygroup" to
"newgroupname":
groupmod -n newgroupname mygroup

groupmod -n newgroupname mygroup


reference: groupmod(8)

16/08/2012 08:29 AM

Users and Groups - OTN Solaris-Unix Command Comparison - Oracle Wiki

4 de 5

https://wikis.oracle.com/display/OTNTaskFinder/Users+and+Groups

for NIS/NIS+ or local /etc filesystem; renames "mygroup" to


"newgroupname":
smgroup modify -- -n mygroup -N newgroupname
reference: smgroup(1M), groupmod(1M)
display groups

display all groups:


smgroup --

display all groups:


getent group

getent group
display a specific group:
smgroup -- -n mygroup
getent group mygroup

display a specific group:


getent group mygroup
reference: getent(1)

logins -g mygroup
reference: smgroup(1M)
set group administrative
password
check integrity of group files

print the groups a user is in:

gpasswd mygroup
reference: gpasswd(8)
grpck

grpck

reference: grpck(1M)

reference: grpck(8)

groups user1

groups user1

reference: groups(1)

reference: groups(1)

add group members:


see also change a user's group
information

gpasswd -a user1 mygroup

remove group members

gpasswd -r user1 mygroup

reference: gpasswd(8)

reference: gpasswd(8)
modify group members

specify a new list of group members (overwrites the existing member


list):
smgroup -- modify -n mygroup -m user1 -m user2 -m

define user1 as group admin with members user2, user3, etc.


gpasswd -A user1 -M user2,user3,... mygroup
reference: gpasswd(8)

user3

Top contributors to this page:


No contributors found for: authors on selected page(s)

16/08/2012 08:29 AM

Users and Groups - OTN Solaris-Unix Command Comparison - Oracle Wiki

5 de 5

Labels:

groups

getent

chage

chpasswd

passwd

newgrp

https://wikis.oracle.com/display/OTNTaskFinder/Users+and+Groups

users

usermod

groupadd

groupdel

groupmod

smuser

smgroup

useradd

userdel

gpasswd

grpck

The individuals who post here are part of the extended Oracle community and they might not be employed or in any way formally affiliated with Oracle. The opinions expressed here
are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Oracle nor any other party necessarily agrees with them.

Terms of Use | Your Privacy Rights

16/08/2012 08:29 AM