You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/sh
user_alignak=alignak
home_dir_alignak=/home/$user_alignak
HOME_SEARCH=`grep ^$user_alignak: /etc/passwd | cut -d: -f 6`
if [[ ! "$HOME_SEARCH" ]]
then
if [ ! -d "$home_dir_alignak" ]; then
sudo useradd -m -p $user_alignak $user_alignak
sudo adduser $user_alignak sudo
id $user_alignak
echo "Info: Create "$user_alignak" user account with the same password."
echo "Info: Please change the password for this account NOW!!!"
passwd $user_alignak
else
echo "Info: "$home_dir_alignak" exist."
fi
else
echo "Info: Alignak-User "$user_alignak" exist."
fi
Remove user "alignak"
#!/bin/sh
user_alignak=alignak
home_dir_alignak=/home/$user_alignak
HOME_SEARCH=`grep ^$user_alignak: /etc/passwd | cut -d: -f 6`
if [[ "$HOME_SEARCH" ]]
then
if [ -d "$home_dir_alignak" ]; then
sudo deluser --remove-home $user_alignak
id $user_alignak
echo "Info: Delete "$user_alignak" user account and files."
fi
else
echo "Info: User "$user_alignak" not exist."
fi
The text was updated successfully, but these errors were encountered:
the user alignak is created thanks to the set_permissions.sh script that will be available as soon as this PR Alignak-monitoring/alignak#667 will be merged.
But I find interesting to add those proposed scripts anyway 😉 but you should make some modifications to adapt them. Here is what is done in the set_permissions.sh script:
## Create user and group
echo "Checking / creating 'alignak' user and users group"
# Note: if the user exists, it's properties won't be changed (gid, home, shell)
adduser --quiet --system --home /var/lib/alignak --no-create-home --group alignak || true
## Create nagios group
echo "Checking / creating 'nagios' users group"
addgroup --system nagios || true
## Add alignak to nagios group
id -Gn alignak |grep -E '(^|[[:blank:]])nagios($|[[:blank:]])' >/dev/null ||
echo "Adding user 'alignak' to the nagios users group"
adduser alignak nagios
## Create directories with proper permissions
for i in /usr/local/etc/alignak /usr/local/var/run/alignak /usr/local/var/log/alignak /usr/local/var/lib/alignak /usr/local/var/libexec/alignak
do
mkdir -p $i
echo "Setting 'alignak' ownership on: $i"
chown -R alignak:alignak $i
done
echo "Setting file permissions on: /usr/local/etc/alignak"
find /usr/local/etc/alignak -type f -exec chmod 664 {} +
find /usr/local/etc/alignak -type d -exec chmod 775 {} +
echo "Terminated"
Add user "alignak"
Remove user "alignak"
The text was updated successfully, but these errors were encountered: