Project

General

Profile

Actions

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

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':

sudo adduser nextcloud

3. Create a Group

Create a group named 'nextcloud':

sudo groupadd nextcloud

4. Add User 'nextcloud' to Group

Add the user 'nextcloud' to the 'nextcloud' group:

sudo usermod -aG nextcloud nextcloud

5. You add the Samba user database using the smbpasswd command:

sudo smbpasswd -a nextcloud

you can check if you add the samba user with - pdbedit -L -v

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.

Setting Up and Configuring FileBrowser Service

Updated by Gareth Eaton 5 months ago · 7 revisions