Skip to content
Snippets Groups Projects
Commit 8c4336de authored by Dirk Sarpe's avatar Dirk Sarpe
Browse files

get script that is currently in use

parent 02761860
No related branches found
No related tags found
No related merge requests found
homedirs.sh 100644 → 100755
#!/bin/bash #!/bin/bash
# script creates home directories for users in rgroup if those do not exist # script creates home directories for users in rgroup if those do not exist
# and sets acl to allow monitoring user disk usage check
set -e set -e
# set -x
# trap read debug
rgroup="g_linuxusers" rgroup="g_r_users"
home="/homes/" home="/homes/"
work="/work/"
rstudiodir=".rstudio"
umask=0077 umask=0077
skel="/etc/skel" skel="/etc/skel"
monitoringuser="monitoring" monitoringuser="monitoring"
...@@ -15,13 +18,31 @@ if [ ! -d $home ] ...@@ -15,13 +18,31 @@ if [ ! -d $home ]
mkdir $home mkdir $home
fi fi
# make sure that fresh credentials are pulled
sss_cache -E
rusers="$(getent group $rgroup | awk -F '[/:]' '{print $4}')" rusers="$(getent group $rgroup | awk -F '[/:]' '{print $4}')"
IFS=',' read -a ruserar <<< "$rusers" IFS=$',' read -a ruserar <<< "$rusers"
for ruser in "${ruserar[@]}" for ruser in "${ruserar[@]}"
do do
# create home directories
if [ ! -d $home$ruser ] if [ ! -d $home$ruser ]
then then
mkhomedir_helper $ruser $umask $skel mkhomedir_helper $ruser $umask $skel
setfacl -m u:${monitoringuser}:rx $home$ruser setfacl -m u:$monitoringuser:rx $home$ruser
fi
# symlink .rstudio directory to work storage
if [ ! -d $work$ruser$rstudiodir ]
then
mkdir -p $work$ruser/$rstudiodir
mkdir -p $home$ruser/$rstudiodir
setfacl -m u:$monitoringuser:rx $work$ruser
setfacl -m u:$monitoringuser:rx $work$ruser/$rstudiodir
setfacl -m u:$ruser:rwx $work$ruser
setfacl -m u:$ruser:rwx $work$ruser/$rstudiodir
mount --bind $work$ruser/$rstudiodir $home$ruser/$rstudiodir
#ln -s $work$ruser/$rstudiodir $home$ruser/$rstudiodir
#chattr +i $home$ruser/$rstudiodir
fi fi
done done
unset IFS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment