#!/bin/bash # su to the given pacakges source `which ttPM-funcs` 2>/dev/null || exit 1 # Should be run as root checkRoot #For all passed params until [ -z "$1" ] do # Check if the user and group exist find / -maxdepth 0 -group $1 2>&1 >/dev/null || error "Group $1 does not exist" find / -maxdepth 0 -user $1 2>&1 >/dev/null || error "User $1 does not exist" # If the home dir does not exist, create HOME_DIR="$TT_HOME_DIR/$1" install -d ${HOME_DIR} ln -sf $TT_ETC_DIR/bashlogin ${HOME_DIR}/.bash_profile ln -sf $TT_ETC_DIR/bashlogout ${HOME_DIR}/.bash_logout chown -R $1.$1 $HOME_DIR 2>/dev/null # su to the given user nice -n +10 su - $1 shift done