You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/labs/networking/lab8-samba.md
+21-23Lines changed: 21 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
author: Wale Soyinka
3
-
contributors:
3
+
contributors: Ganna Zhyrnova
4
4
tested on: All Versions
5
5
tags:
6
6
- samba
@@ -29,12 +29,12 @@ Estimated time to complete this lab: 40 minutes
29
29
30
30
Samba allows for file sharing and printing services between Unix/Linux and Windows systems.
31
31
32
-
Samba is an opensource implementation of the “Common Internet File System” (CIFS). CIFS is also referred to as the Server Message Block (SMB), Lan Manager or NETBIOS protocol.
33
-
The Samba server comprises of two main daemons – smbd and nmbd.
32
+
Samba is an open-source “Common Internet File System” (CIFS) implementation. CIFS is also referred to as the Server Message Block (SMB), LAN manager, or NetBIOS protocol.
33
+
The Samba server comprises two main daemons – smbd and nmbd.
34
34
35
-
*smbd* : This daemon provides the file and print services to SMB clients, such as machines running various Microsoft operating systems.
35
+
*smbd*: This daemon provides file and print services to SMB clients, such as machines running various Microsoft operating systems.
36
36
37
-
*nmbd*: This daemon provides NETBIOS name serving and browsing support.
37
+
*nmbd*: This daemon provides NETBIOS name serving and browsing support.
38
38
39
39
40
40
The exercises in this lab focus on setting up Samba as both a server and a client on a Rocky Linux server.
@@ -54,7 +54,7 @@ The exercises in this lab focus on setting up Samba as both a server and a clien
54
54
55
55
#### To configure Samba
56
56
57
-
1. Create a directory to be shared named samba-share under the /tmp folder. Type:
57
+
1. Create a directory named samba-share under the /tmp folder to be shared. Type:
58
58
59
59
```bash
60
60
mkdir /tmp/samba-share
@@ -91,13 +91,13 @@ The exercises in this lab focus on setting up Samba as both a server and a clien
91
91
92
92
### Samba users
93
93
94
-
An important and common administrative task for managing a Samba server is creating users, creating passwords for users that need to access the shared resources.
94
+
An important and common administrative task for managing a Samba server is creating users and passwords for users who need to access the shared resources.
95
95
96
96
This exercise shows how to create Samba users and set up access credentials for the users.
97
97
98
-
#### To create a Samba user and samba password
98
+
#### To create a Samba user and Samba password
99
99
100
-
1. First create a regular system user named sambarockstar. Type:
100
+
1. First, create a regular system user named sambarockstar. Type:
101
101
102
102
```bash
103
103
sudo useradd sambarockstar
@@ -107,8 +107,7 @@ This exercise shows how to create Samba users and set up access credentials for
107
107
```bash
108
108
id sambarockstar
109
109
```
110
-
3. Add the new sambarockstar system user to the Samba user database and simultanously
111
-
set a password for the Samba user:
110
+
3. Add the new sambarockstar system user to the Samba user database and simultaneously set a password for the Samba user:
112
111
113
112
```bash
114
113
sudo smbpasswd -a sambarockstar
@@ -124,7 +123,7 @@ This exercise shows how to create Samba users and set up access credentials for
124
123
125
124
### Accessing Samba Share (Local test)
126
125
127
-
In this exercise, we'll try accessing the new Samba share from the same system. This means that we'll be using the same host as both a server and client.
126
+
In this exercise, we'll try accessing the new Samba share from the same system. This means that we'll be using the same host as both a server and a client.
128
127
129
128
#### To install Samba client tools
130
129
@@ -148,7 +147,7 @@ In this exercise, we'll try accessing the new Samba share from the same system.
148
147
sudo mount -t cifs //localhost/Shared ~/samba-client -o user=sambarockstar
149
148
```
150
149
151
-
2. Use the `mount` command to list all mounted CIFStype file systems. Type:
150
+
2. Use the `mount` command to list all mounted CIFS-type file systems. Type:
152
151
```bash
153
152
mount -t cifs
154
153
```
@@ -158,7 +157,7 @@ In this exercise, we'll try accessing the new Samba share from the same system.
158
157
...<SNIP>...
159
158
```
160
159
161
-
3. Similarly use the `df` command to verify that the mounted share is available. Type:
160
+
3. Similarly, use the `df` command to verify that the mounted share is available. Type:
162
161
163
162
```bash
164
163
df -t cifs
@@ -170,7 +169,7 @@ In this exercise, we'll try accessing the new Samba share from the same system.
4. Next list the contents of the mounted share. Type:
172
+
4. Next, list the contents of the mounted share. Type:
174
173
175
174
```bash
176
175
ls ~/samba-client
@@ -210,11 +209,11 @@ In this exercise, we'll try accessing the new Samba share from the same system.
210
209
211
210
### Using Samba for specific user groups
212
211
213
-
This exercise will walk through how to restrict access to Samba shares via a user's local group membership. This provides a convenient mechanism for making shared resources accessible only to specific user groups.
212
+
This exercise will walk through restricting access to Samba shares via a user's local group membership. This provides a convenient mechanism for making shared resources accessible only to specific user groups.
214
213
215
214
#### To create a new group for Samba user
216
215
217
-
1. Use the groupadd utility to create a new system group named rockstars. This is the group that we'll use in our example for housing system users that can access a given resource. Type:
216
+
1. Use the groupadd utility to create a new system group named rockstars. We'll use this group in our example for housing system users who can access a given resource. Type:
218
217
```bash
219
218
sudo groupadd rockstars
220
219
```
@@ -224,8 +223,7 @@ This exercise will walk through how to restrict access to Samba shares via a use
224
223
```
225
224
#### To configure valid users in Samba configuration
226
225
227
-
1. Use the sed utility to add a new valid users paranter to the share definition in the
228
-
Samba config file. Type:
226
+
1. Use the sed utility to add new valid user parameters to the share definition in the Samba config file. Type:
229
227
```bash
230
228
sudo sed -i '/\[Shared\]/a valid users = @sambagroup' /etc/samba/smb.conf
231
229
```
@@ -238,18 +236,18 @@ This exercise will walk through how to restrict access to Samba shares via a use
238
236
239
237
## Exercise 6
240
238
241
-
This exercise simulates a real-world scenario where you'll act in the role of an Administrator of a client system, and then test accessing the Samba service on remote system (serverHQ) on which you do not have any Administrative access or privileges. client as a student, will set up a Samba client on your machine (serverXY) to access a Samba service hosted on a different machine (serverHQ). This reflects common workplace setups.
239
+
This exercise simulates a real-world scenario in which you'll act as an administrator of a client system and then test accessing the Samba service on the remote system (server HQ), to which you do not have any administrative access or privileges. As a student, you will set up a Samba client on your machine (serverXY) to access a Samba service hosted on a different machine (serverHQ). This reflects standard workplace setups.
242
240
243
241
Assumptions:
244
242
245
-
- You do not have root access on serverHQ.
243
+
- You do not have root access to serverHQ.
246
244
- The Samba share on serverHQ is already set up and accessible.
247
245
248
246
#### To set up Samba client on serverXY
249
247
250
248
Configure your machine (serverXY) as a Samba client to access a shared directory on a separate host (serverHQ).
251
249
252
-
1. Ensure that the necessary samba client utilities are installed on your local system.
250
+
1. Ensure the necessary Samba client utilities are installed on your local system.
253
251
Install them if necessary by running:
254
252
255
253
```bash
@@ -292,4 +290,4 @@ You will need the IP address or hostname of serverHQ, the share name, and your S
0 commit comments