ÿØÿà JFIF ` ` ÿþ
|
Server : Apache System : Linux cloud.heroica.com.br 4.18.0-553.36.1.el8_10.x86_64 #1 SMP Wed Jan 22 03:07:54 EST 2025 x86_64 User : farolpborg ( 1053) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /etc/Acronis/Scripts/ |
Upload File : |
#!/bin/bash
# This script is part of Acronis Backup
# It is supported by Acronis only as part of the entire solution in accordance with http://www.acronis.com/support/eula-corp.html
# By using this script you accept the terms of the EULA http://www.acronis.com/support/eula-corp.html
# Use outside of the solution is done at your own risk and will not be supported by Acronis
# Contact http://www.acronis.com/en-us/support/ with any questions or concerns
# Copyright (C) 2020 Acronis
# args - USER GROUP_TO_ADD DIR_TO_ADJUST_ATTRS
USER="$1"; shift
GROUP_TO_ADD="$1"; shift
DIR_TO_ADJUST_ATTRS="$1"; shift
function check_user_exists()
{
id "$1" &>/dev/null;
}
function check_group_exists()
{
getent group "$1" &>/dev/null;
}
if [ -z "$USER" -o -z "$GROUP_TO_ADD" -o -z "$DIR_TO_ADJUST_ATTRS" ]; then
exit 1
fi
check_user_exists "$USER"
if [ "$?" != "0" ]; then
exit 1
fi
check_group_exists "$GROUP_TO_ADD"
if [ "$?" != "0" ]; then
groupadd -f "$GROUP_TO_ADD"
if [ "$?" != "0" ]; then
exit 1
fi
fi
if [ ! -d "$DIR_TO_ADJUST_ATTRS" ]; then
mkdir -m 770 -p "$DIR_TO_ADJUST_ATTRS"
if [ "$?" != "0" ]; then
exit 1
fi
fi
usermod -a -G "$GROUP_TO_ADD" "$USER"
if [ "$?" != "0" ]; then
exit 1
fi
chown -f "root.$GROUP_TO_ADD" "$DIR_TO_ADJUST_ATTRS"
if [ "$?" != "0" ]; then
exit 1
fi
exit 0