Project

General

Profile

Adding a Samba server to Nextcloud » History » Version 3

Gareth Eaton, 12/19/2023 01:33 AM

1 1 Gareth Eaton
h1. Adding a Samba server to Nextcloud
2
3
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.
4
5
6
1. **Install Ubuntu and Update**
7
8 2 Gareth Eaton
Install Ubuntu and update your system.
9 1 Gareth Eaton
10
<pre>
11
   sudo apt install samba
12
</pre>
13
14
3. **Add User 'nextcloud'**
15
16 2 Gareth Eaton
Add a user named 'nextcloud':
17 1 Gareth Eaton
18
<pre>
19
   sudo adduser nextcloud
20
</pre>
21
22
4. **Create a Group**
23
24 2 Gareth Eaton
Create a group named 'nextcloud':
25 1 Gareth Eaton
26
<pre>
27
   sudo groupadd nextcloud
28
</pre>
29
30
5. **Add User 'nextcloud' to Group**
31
32 2 Gareth Eaton
Add the user 'nextcloud' to the 'nextcloud' group:
33 1 Gareth Eaton
34
<pre>
35
   sudo usermod -aG nextcloud nextcloud
36
</pre>
37
38
6. **Create a Data Directory**
39
40 2 Gareth Eaton
Create a directory for your data:
41 1 Gareth Eaton
42
<pre>
43
   mkdir /srv/data
44
</pre>
45
46
7. **Set Permissions**
47
48 2 Gareth Eaton
Set the ownership and permissions for the data directory:
49 1 Gareth Eaton
50
<pre>
51
   sudo chown nextcloud:nextcloud /srv/data
52
   sudo chmod 770 /srv/data
53
</pre>
54
55
8. **Backup Samba Configuration**
56
57 2 Gareth Eaton
Create a backup of the Samba configuration file:
58 1 Gareth Eaton
59
<pre>
60
   sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
61
</pre>
62
63
9. **Edit Samba Configuration**
64
65 2 Gareth Eaton
Edit the Samba configuration file using the Nano text editor:
66 1 Gareth Eaton
67
<pre>
68
   sudo nano /etc/samba/smb.conf
69
</pre>
70
71 2 Gareth Eaton
Add the following configuration to the file:
72 1 Gareth Eaton
73
<pre>
74
   [global]
75
      server min protocol = SMB3
76
      server max protocol = SMB3
77
      ntlm auth = ntlmv2-only
78
      server role = standalone server
79
      obey pam restrictions = yes
80
      unix password sync = yes
81
      passwd program = /usr/bin/passwd %u
82
      passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
83
      pam password change = yes
84
      map to guest = never
85
      encrypt passwords = yes
86
      security = user
87
88
   [Documents]
89
      path = /srv/data
90
      browseable = yes
91
      read only = no
92
      smb encrypt = mandatory
93
      valid users = nextcloud
94
      force group = nextcloud
95
      create mask = 0660
96
      directory mask = 0770
97
</pre>
98
99
10. **Restart Samba**
100
101 2 Gareth Eaton
Restart the Samba service to apply the changes:
102 1 Gareth Eaton
103
<pre>
104
    sudo systemctl restart smbd
105
</pre>
106
107
11. **Review and Make Further Changes**
108
109 2 Gareth Eaton
Review your Samba configuration and make any additional changes as needed.
110 3 Gareth Eaton
111
[[Setting Up and Configuring FileBrowser Service]]