Project

General

Profile

Wiki » History » Version 7

Gareth Eaton, 12/18/2023 01:55 AM

1 1 Gareth Eaton
h1. Share a Linux Mint folder
2
3 4 Gareth Eaton
[[My file setup]]
4
5 2 Gareth Eaton
also See - [[ Setting up the smb.conf file]]
6
7 3 Gareth Eaton
also See - [[How to Fix "Weak Crypto is Allowed" in Samba]]
8
9
10 1 Gareth Eaton
* Install Samba.
11
* Check the Samba server status.
12
* Allow Samba across the firewall.
13
* Add user to Sambashare group.
14
* Set SambaShare password.
15
* Click sharing option.
16
* Turn on the share folder toggle.
17
18
h2. Step 1:  Perform a system update.
19
20
<pre>
21
sudo apt update
22
</pre>
23
24
h2. Step 2: Samba installation in Linux Mint
25
26
<pre>
27
sudo apt install samba
28
</pre>
29
30
Once it has been installed, run the command below to ascertain that the service is up and running:
31
32
<pre>
33
sudo systemctl status smbd
34
</pre>
35
36
If the service is not active, execute the following line of code:
37
<pre>
38
sudo systemctl --enable now smbd
39
</pre>
40
41
h2. Step 3: Allow Samba across the Linux Mint Firewall
42
43
To connect to and access shared files using SMB protocol, we must whitelist and enable access to its service from outside the machine. As a result, we will allow it in the firewall.
44
<pre>
45
sudo ufw allow samba
46
</pre>
47
48
h2. Step 4: Include your user in the Samba group.
49
50
Allow the current System user to access all files and folders shared under it by adding it to the SambaShare group. To do so, execute the following line of code:
51
<pre>
52
sudo usermod -aG sambashare $USER
53 7 Gareth Eaton
54
or
55
56
sudo smbpasswd -a newusername
57
58 1 Gareth Eaton
</pre>
59
60
Next, set the share password: This should be distinct from your system password.
61
62
<pre>
63
sudo smbpasswd -a $USER
64
</pre>
65
66
Note that $USER refers to your current user; if you wish to set a different user, replace $USER with the user’s name. Furthermore, the file or folder you want to share must be available to that specific user.
67
<pre>
68
sudo usermod -aG sambashare your-user
69
</pre>
70
71
To set a password, execute the following line of code:
72
<pre>
73
sudo smbpasswd -a your-user
74
</pre>
75
That’s it. SMB (Samba) has been installed and configured correctly on our Linux Mint OS. To test it out, we shall try the following:
76
Assuming I want to share the “Shared” folder or any other folder on my Linux Mint that my current user owns. Navigate to that folder, right-click it, and pick the “Sharing options” tab.
77 5 Gareth Eaton
78 1 Gareth Eaton
Note: Occasionally, you might realize that the “Share this folder” option has been toggled off. To enable sharing, toggle on that option and check the “Allow others to create and delete files in this folder”. Once you are done, input the shared folder name and comment if need be and click the “Create share” button.
79 5 Gareth Eaton
80
81
Show Users
82
<pre>
83
sudo pdbedit -L
84 6 Gareth Eaton
</pre>
85 5 Gareth Eaton
86 6 Gareth Eaton
remove a user
87
<pre>
88
sudo pdbedit -x -u username
89
90
or
91
92
sudo smbpasswd -x username
93
</pre>
94
95
To remove the root user from your Samba user database,
96
<pre>
97
sudo pdbedit -x -u root
98 5 Gareth Eaton
</pre>