Raspberry Pi Samba Setup for Webserver
Install samba
sudo apt-get install samba samba-common-bin wsdd -y
Issue the command
user=<username>
echo -e "[$user]\n\twritable = yes\n\tforce user = $user\n\tforce group = $user\n\tdirectory mode = 0700\n\tcreate mode = 0600\n\tpath = /home/$user\n\tvalid users = $user,@$user" | sudo tee -a /etc/samba/smb.conf
to add user james to the configuration file.
Restart the samba server.
sudo systemctl restart smbd
Set a password for Samba user,
sudo smbpasswd -a $user
Issue the command
echo "echo -e "[web]\n\twritable = yes\n\tforce user = www-data\n\tforce group = www-data\n\tdirectory mode = 0700\n\tcreate mode = 0600\n\tpath = /var/www/html\n\tcreate mask = 0664\n\tforce create mode = 0664\n\tdirectory mask = 02775\n\tforce directory mode = 02775\n\tvalid users = $user,@$user\n" | sudo tee -a /etc/samba/smb.conf
sudo usermod -a -G www-data $user
to add a web user after installing a web server.