[[shellscripts:user-anlegen]]

User anlegen

Aufruf: mkuser.sh USERNAME

#!/bin/bash
if [ "`id -u`" -eq 0 ]; then
 
        if [ -z $1 ]; then
        echo "no username given"
        echo "usage: $0 [username]"
        exit 1
        else
            useradd -m $1
            passwd $1
            chmod 700 /home/$1
            chmod 600 /home/$1/.bash*
        fi
else
        echo you are not root! use "su" or "sudo"...
fi