User Tools

Site Tools


releases:3.2.0:usersguide:managinguseraccounts

Managing User Accounts

You'll need to be the root user to do any of the following.

Adding a New Group

To add a new user group to the system you need to add an entry to the /etc/group file.

The entry format is: “<group name>:*:<group id>:”

The group ids already used by MINIX are 0-11, 26, and 99.

You can edit the /etc/group file with any text editor or do the following:

# Add the 'wheel' user group with the group id of 12.
echo 'wheel:*:12:' >> /etc/group

{i} On MINIX 3.2.0, use the group add command:

group add wheel

Adding a New User

To add a new user to the system run the adduser command. The arguments to adduser are the user name, the group name, and the user's home directory. The group must already exist and the user must not.

Examples:

adduser foo other /home/foo

adduser anotherroot operator /root2

adduser mike staff /home/mike

adduser steve management /home/steve

adduser fred boss /home/fred

The typical values for new users is other (for ordinary users) or operator (for system administrator) for the group, and /home/<user name> for the home directory.

{i} On MINIX 3.2.0:

user add -m -g users foo

user add -m -d /root2 -g operator anotherroot

The new user's full name and password will be unset and the default shell will be sh. To change them use the chfn, passwd, and chsh commands or have the user set them themselves after logging in.

Examples:

chfn foo 'Foo Bar'

chsh anotherroot /bin/zsh

{i} On MINIX 3.2.0, much of this can be changed using user mod [user].

Operator users

The system has been set up with the idea that working as root is a bad thing to do. As root you are in no way protected from doing stupid things. So do not do development as root, but work as bin! Only in exceptional cases do you want to become root. Being root is fun for wannabe hackers; administrators know better.

To make life easier for bin some programs like su(1), install(1) and shutdown(8) treat bin and other members of the operator group as special and allow them the privileges of root. (One is an operator if one 's group id is zero.) Operators should share the shadow password of root by having ##root in their password field. This way they all have one face (password) to the outside world, forming no greater security risk than root alone.

Default Home Directory Contents

When you create a new user the contents of the /usr/ast directory is copied to the user's new home directory. To change the default files provided whenever a new user is created just change the contents of this directory.

Removing a User

To remove a user you will need to manually remove them from the /etc/passwd and /etc/shadow file. This can be done in any text editor. The first field on each line is the user's login name.

You can also do the following to remove a user without editing the file by hand:

# Removing the user 'foobar'
grep -v '^foobar:' /etc/passwd > /tmp/passwd
mv /tmp/passwd /etc/passwd
grep -v '^foobar:' /etc/shadow > /tmp/shadow
mv /tmp/shadow /etc/shadow

Note that you will probably want to make a backup of the /etc/passwd and /etc/shadow files before doing this and then verify that the user you want to remove (and only the user you wanted to remove) is gone from the new passwd file before overwriting the old one (this can be done with diff.

Once the user is gone you can remove their home directory if you wish.

{i} On MINIX 3.2.0, this is different.

To remove a user:

user del foo

To remove a user and their home directory:

user del -r foo

Removing a Group

Removing a group is very similar to removing a user. All you need to do is edit the /etc/group file or the following:

# Removing the group named 'wheel'
grep -v '^wheel:' /etc/group > /tmp/group
mv /tmp/group /etc/group

{i} On MINIX 3.2.0:

group del wheel
releases/3.2.0/usersguide/managinguseraccounts.txt · Last modified: 2014/11/14 07:51 by lionelsambuc