Adding a tox user

This commit is contained in:
Bob Mottram 2016-10-02 11:21:56 +01:00
parent f4f50eaf02
commit 3c920b5c44
1 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,19 @@ function remove_user_tox {
fi fi
} }
function add_user_tox {
new_username="$1"
new_user_password="$2"
USER_TOX_FILE=/home/${new_username}/.config/tox/data.tox
if [ ! -f $USER_TOX_FILE ]; then
mkdir -p /home/${new_username}/.config/tox
chown -R ${new_username}:${new_username} /home/${new_username}/.config
su -c "toxid -u ${new_username} -n data" - $new_username
su -c "toxid --setuser ${new_username}" - $new_username
fi
}
function run_client_tox { function run_client_tox {
# create a tox user # create a tox user
USER_TOX_FILE=/home/${USER}/.config/tox/data.tox USER_TOX_FILE=/home/${USER}/.config/tox/data.tox