User Tools

Site Tools


linux:sysadmin:user_management

User Management

Create a user with useradd

The following command creates the user “ftpexample” with the following attributes:

value
username ftpexample
group example
home directory /home/www/sta/example/
comment / name example SA - Marcel Muster
shell no shell access (ftp only)

Create a group for the user ftpexample first (if the group doesn't exist yet):

groupadd example

Create the user with all options from above:

useradd -d /home/www/sta/example/ -c "example SA - Marcel Muster" -G example -s /sbin/nologin ftpexample
If you want prevent the users from login (ftp only) set the shell to /sbin/nologin.

Set a password for the user

Generate a password:

cat /dev/urandom | strings -n 8 | head -5

Set the password:

passwd ftpexample

Add the user to a new group

usermod -a -G newgroup ftpexample

Change primary group of a user

usermod -g newgroup ftpexample
/srv/wiki.niwos.com/data/pages/linux/sysadmin/user_management.txt · Last modified: 2011/07/19 16:46 (external edit)