Project

General

Profile

Actions

Adding a Samba server to Nextcloud » History » Revision 1

Revision 1/7 | Next »
Gareth Eaton, 12/19/2023 01:16 AM


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.
   sudo apt install samba

3. Add User 'nextcloud'

Add a user named 'nextcloud':
   sudo adduser nextcloud

4. Create a Group

Create a group named 'nextcloud':
   sudo groupadd nextcloud

5. Add User 'nextcloud' to Group

Add the user 'nextcloud' to the 'nextcloud' group:
   sudo usermod -aG nextcloud nextcloud

6. Create a Data Directory

Create a directory for your data:
   mkdir /srv/data

7. Set Permissions

Set the ownership and permissions for the data directory:
   sudo chown nextcloud:nextcloud /srv/data
   sudo chmod 770 /srv/data

8. Backup Samba Configuration

Create a backup of the Samba configuration file:
   sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

9. Edit Samba Configuration

Edit the Samba configuration file using the Nano text editor:
   sudo nano /etc/samba/smb.conf
Add the following configuration to the file:
   [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

10. Restart Samba

Restart the Samba service to apply the changes:
    sudo systemctl restart smbd

11. Review and Make Further Changes

Review your Samba configuration and make any additional changes as needed.

Updated by Gareth Eaton 11 months ago · 1 revisions