# CHECKS ################################ DATADIR=$( sudo -u www-data php /var/www/nextcloud/occ config:system:get datadirectory ) || { echo -e "Error reading data directory. Is NextCloud running and configured?"; } [ -d "$DATADIR" ] || { echo -e "data directory $DATADIR not found" ; } # CONFIG ################################ # remove files from this line to the end sed -i '/# NextCloudSmb automatically/,/\$/d' /etc/samba/smb.conf # restore this line cat >> /etc/samba/smb.conf <> /etc/samba/smb.conf </dev/null || adduser --disabled-password --force-badname --gecos "" "$user" echo -e "$PWD\n$PWD" | smbpasswd -s -a $user usermod -aG www-data $user sudo chmod g+w $DIR done systemctl enable --now smbd systemctl enable --now nmbd echo "SMB enabled"