Adding a Samba server to Nextcloud » History » Revision 5
Revision 4 (Gareth Eaton, 12/21/2023 02:00 PM) → Revision 5/7 (Gareth Eaton, 12/21/2023 02:01 PM)
h1. Adding a Samba server to Nextcloud Combining a Samba server with Nextcloud is beneficial because it enables unified file access, scalable file sharing, enhanced security, and seamless collaboration, making it easier for users to manage and share files while providing flexibility for remote and mobile access. 1. **Install Ubuntu and Update** Install Ubuntu and update your system. <pre> sudo apt install samba </pre> Before you can create a Samba user, you need to create a corresponding Linux user account. This account will be used to authenticate with the Samba server. 2. **Add User 'nextcloud'** Add a user named 'nextcloud': <pre> sudo adduser nextcloud </pre> 3. **Create a Group** Create a group named 'nextcloud': <pre> sudo groupadd nextcloud </pre> 4. **Add User 'nextcloud' to Group** Add the user 'nextcloud' to the 'nextcloud' group: <pre> sudo usermod -aG nextcloud nextcloud </pre> 5. You add the Samba user database using the smbpasswd command: <pre> sudo smbpasswd -a nextcloud sambauser </pre> 6. **Create a Data Directory** Create a directory for your data: <pre> mkdir /srv/data </pre> 7. **Set Permissions** Set the ownership and permissions for the data directory: <pre> sudo chown nextcloud:nextcloud /srv/data sudo chmod 770 /srv/data </pre> 8. **Backup Samba Configuration** Create a backup of the Samba configuration file: <pre> sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup </pre> 9. **Edit Samba Configuration** Edit the Samba configuration file using the Nano text editor: <pre> sudo nano /etc/samba/smb.conf </pre> Add the following configuration to the file: <pre> [global] server min protocol = SMB3 server max protocol = SMB3 ntlm auth = ntlmv2-only server role = standalone server obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = never encrypt passwords = yes security = user [Documents] path = /srv/data browseable = yes read only = no smb encrypt = mandatory valid users = nextcloud force group = nextcloud create mask = 0660 directory mask = 0770 </pre> 10. **Restart Samba** Restart the Samba service to apply the changes: <pre> sudo systemctl restart smbd </pre> 11. **Review and Make Further Changes** Review your Samba configuration and make any additional changes as needed. [[Setting Up and Configuring FileBrowser Service]]