Project

General

Profile

Wiki » History » Version 6

Gareth Eaton, 12/18/2023 01:52 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
</pre>
54
55
Next, set the share password: This should be distinct from your system password.
56
57
<pre>
58
sudo smbpasswd -a $USER
59
</pre>
60
61
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.
62
<pre>
63
sudo usermod -aG sambashare your-user
64
</pre>
65
66
To set a password, execute the following line of code:
67
<pre>
68
sudo smbpasswd -a your-user
69
</pre>
70
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:
71
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.
72 5 Gareth Eaton
73 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.
74 5 Gareth Eaton
75
76
Show Users
77
<pre>
78
sudo pdbedit -L
79 6 Gareth Eaton
</pre>
80 5 Gareth Eaton
81 6 Gareth Eaton
remove a user
82
<pre>
83
sudo pdbedit -x -u username
84
85
or
86
87
sudo smbpasswd -x username
88
</pre>
89
90
To remove the root user from your Samba user database,
91
<pre>
92
sudo pdbedit -x -u root
93 5 Gareth Eaton
</pre>