#!/bin/bash while IFS=';' read -r uid username service server do home="/data/$service" if [ -z "$(grep "^$username:" /etc/passwd)" ] ; then useradd -m -U -r -d "$home" "$username" fi # Do not touch the group, it can be set to something useful chown "$username" "$home" chmod 770 "$home" done < <(grep -v '^#' /docker/services.csv)