Quick Guide - Solaris User Add, Mod, Del
Quick Guide - Solaris User Add, Mod, Del
pp. 1
User Adds, Mods, and Dels
1. useradd
$ sudo useradd -m -d /export/home/plath plath
Create user plath with home directory d
m forces creation of directory
-g would set primary login group, while -G specifies secondary groups
-c can be used to set users full name, like $ useradd -c Sylvia P. plath
2. usermod
$ sudo usermod -s /bin/zsh -d /export/home/z_plath plath
Change plaths shell to zsh and home directory to z_plath
$ sudo usermod -u 112 plath
Change plaths UID
3. userdel
$ sudo userdel [-r] plath
-r option deletes home directory.
SysAdmins advise against deleting -- instead, recommended to lock accounts.
4. passwd
$ sudo passwd plath
Password: //root pass
New Password: //new pass
Re-enter new Password:
-f forces password change on first login
5. groupadd
$ sudo groupadd -U plath -g 1015 cnfssnl
$ fgrep plath /etc/group
cnfssnl::1015:plath
ajordan, 07/16/14
pp. 2
File Locations &c.
1. /etc/passwd
Stores configuration info on user account (not exactly does it store the pw -- see shadow)
plath:x:112:10::/export/home/plath:/usr/bin/bash
username:x:uid:gid:GECOS:home:shell
x indicates the shadow password suite is in use. GECOS, named for GE operating system, typically
holds users full name, maybe more. Only field that can contain a space.
2. /etc/shadow
Encrypted password.
plath:$5$TJ2TjfYC$LTI0xu67XzbbtYVrTwGTzZ0l6GuHHk2R0PEdT0lhnM3:16272::::::
username:encoded_password:last_changed:mindays:maxdays:warn:inactive:expire:
reserved
last_changed, number of days after January 1, 1970 that the password was last changed set to 0 it
will force a user to change their password upon next login.
warn is the password warning period, how many days before a password expires during which the
user should be warned.
inactive is the password inactivity period the number of days after a password has expired during
which the password will still be accepted.
expire is the account expiration date, expressed as the number of days since Jan 1, 1970.
Final field is reserved for future use. (source for info, on shadow and all: http://www.tokiwinter.com)
3. /etc/group
Holds info on configuration of security groups and members of groups; members can also be set under
the GID parameter in /etc/passwd (check both!)
staff::10:
group_name:passwd:GID:user_list
The Solaris manual page for group(4) states Group passwords are antiquated and not often used.
4. Defaults
$ useradd -D -g 10 -s /bin/zsh -b /export/homes
-D sets useradd defaults -- here, we set default group ID to 10, default shell to zsh, and default user
home to /export/homes
ajordan, 07/16/14
pp. 3
5. /etc/default/passwd
Stores parameters for password complexity and security.
6. /etc/sudoers
Controls root permissions, e.g.:
root ALL=(ALL) ALL
adam ALL=(ALL) NOPASSWD: ALL
Lock Accounts
Preferred method of getting rid of user accounts over userdel
1. passwd -l
$ sudo passwd -l plath
In /etc/shadow, the string *LK* gets pre-pended to the encrypted password field.
plath:*LK*$5$TJ2TjfYC$LTI0xu67XzbbtYVrTwGTzZ0l6GuHHk2R0PEdT0lhnM3:16272:::::20211
2. Unlock Accounts
$ sudo passwd -u plath
ajordan, 07/16/14
pp. 4
Start to Finish - Example
Below, well create a usergroup for L=A=N=G=U=A=G=E poets from which new users Lyn Hejinian and
Ron Silliman will inherit their user properties.
1. /etc/default/password
$ sudo vi /etc/default/passwd
MAXWEEKS=52
MINWEEKS=
PASSLENGTH=7
HISTORY=1
:wq
2. $ groupadd
$ sudo groupadd -g 1005 language
3. $ useradd
$ sudo useradd -m -d /export/home/hejinian \
> -c "Lyn Hejinian" -g language hejinian
$ sudo useradd -m -d /export/home/silliman \
> -c "Ron Silliman" -g language Silliman
4. $ passwd
$ sudo passwd hejinian
New Password: L=A=N=G=U=A=G=E
Re-enter new Password: L=A=N=G=U=A=G=E
$ sudo passwd -f hejinian
$ sudo passwd silliman
New Password: L=A=N=G=U=A=G=E
Re-enter new Password: L=A=N=G=U=A=G=E
$ sudo passwd -f silliman
5. Wrap it up! Optional:
$ sudo visudo //add users to sudoers file
ajordan, 07/16/14
pp. 5
...................................................................................................................... Other notes, tips and commands
1. UID is automatically created, incrementing up from 100
2. $ fgrep plath /etc/passwd
a. Fgrep searches <file> for plath
3. $ logins -xo
a. Provides info on users; also try -a