Wednesday, July 8, 2009

Adding user in Sun Solaris

If you want to create a new group, use the groupadd command, eg, if you want to create a group call user, then just type

groupadd user

The above command will automatically create a group called "user" and assign a group id (gid) to it.

To create a user, use the command useradd, so for example you want to create a user call strovek, then just type:

useradd strovek

This will automatically create a user, assign and user id (uid) to it. You can alternatively assign the userid and the group id to it by use -g to assign a gid to the assign a uid by use -u parameter and -d to assign a home folder to it.

Next create a folder (or can be created earlier), using mkdir:

mkdir /export/home/strovek

Then change the owner of the folder using chown:

chown strovek:user /export/home/strovek

If you had not set the home folder earlier, you can do that using usermod, as in

usermod -d /export/home/strovek strovek

Set the password for the user using passwd, as in

passwd strovek

When you type the above, it will prompt you for the new password and then a confirmation.

To remove the account, just type userdel, as in

userdel strovek

The Solaris Administrator guide can be found here.

No comments: