summaryrefslogtreecommitdiff
path: root/tasks/smb_nfs/howtos/en/index.html
blob: fe056b437428f46661ad16531e8d72fed22b1fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<html>
<head>
<meta http-equiv="content-type" content="text/html" charset="utf-8">
<title>smb_nfs</title>
<style type="text/css">
	#code {
		font-family: Courier New; 
		font-size: 12;
	}
</style>
</head>
<body>
	<h1>
		smb_nfs
	</h1>
	<p>
		<a href="#vb">VirtualBox</a> | <a href="#server">Server</a> | <a href="#client">Client</a> | <a href="#nfs">NFS</a> | <a href="#smb">Samba</a> | <a href="#dhcp">DHCP</a>
	</p>
	<h2>
		Quick guide
	</h2>
		<p>
			Set up two virtual computers - SimpleArbiterDhcp and FileServer.
		</p>
		<p>
			Make sure that the directory /srv/nfs/ERLbbBrT on FileServer is accessible
			over NFS and over SMB under the sharename urania-03.
			Set the SMB server name to zarptica-32.
		</p>
		<p>
			SimpleArbiterDhcp should have write access to /srv/nfs/ERLbbBrT over NFS.
		</p>

	<h2>
		Instructions
	</h2>
	<ul style="list-style: none;">
		<li>
			<h3>
				Download these VM images:
			</h3>
			<ul type="disc">
				<li>
					student-fileserver.vdi
				</li>
				<li>
					simpleArbiterDhcpGW.vdi
				</li>
				<br>
			</ul>
		</li>
		<a name="vb"></a>
		<li>
			<h3>
				VirtualBox Settings:
			</h3>
			<ul type="disc">
				<li>
					Enable PAE/NX for both VMs: Settings&rArr;System&rArr;Processor
				</li>
				<li>
					For FileServer
					<ul>
						<li>
							Adapter 1 - NAT
						</li>
						<li>
							Adapter 2 - Internal Network
							</li>
					</ul>
				</li>
				<li>
					For SimpleArbiterDhcp
					<ul>
						<li>
							Adapter 1 - Internal Network
						</li>
					</ul>
				</li>
			</ul>
		</li>
		<br>
		<a name="server"></a>
		<li>
			<h3>
				Server FileServer
			</h3>
			<ol>
				<a name="dhcp"></a>
				<li>
					Set up a DHCP server
					<ol>
						<li>
							<span id="code">
								apt-get update
							</span>
						</li>
						<li>
							<span id="code">
								apt-get install isc-dhcp-server
							</span>
						</li>
						<li>
							The server will not start (error 
							<span id="code">
								Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!</span>)
								, configure 3 files:
							<ul>
								<li>
									In /etc/network/interfaces set static IP for eth1 on which the DHCP server will be running,
								e.g.:
									<p id="code">
										auto eth1<br>
										iface eth1 inet static<br>
										address 192.168.1.10<br>
										netmask 255.255.255.0<br>
										network 192.168.1.0<br>
										broadcast 192.168.1.255<br>
									</p>
								</li>
								<li>
									In /etc/default/isc-dhcp-server:
									<p id="code">
										INTERFACES="eth1"
									</p>
								</li>
								<li>
									In /etc/dhcp/dhcpd.conf configure the subnet properties,
								e.g.:
									<p id="code">
										authoritative;<br>
										default-lease-time 600;<br>
										max-lease-time 7200;<br>
										<br>
										subnet 192.168.1.0 netmask 255.255.255.0 {<br>
										range 192.168.1.100 192.168.1.200;<br>
										option routers 192.168.1.10;<br>
										option domain-name-servers 193.2.1.66, 8.8.4.4;<br>
										<br>
										host SimpleArbiter {<br>
										hardware ethernet 08:00:27:A2:FB:B4;<br>
										fixed-address 192.168.1.180;<br>
										}<br>
										}<br>
									</p>
								</li>
							</ul>	
						</li>
					</ol>
				</li>
				<a name="nfs"></a>
				<li>
					Set up a NFS server
					<ol>
						<li>
							apt-get install nfs-kernel-server
						</li>
						<li>
							Determine the rules in /etc/exports, e.g.:
							<p id="code">
								#privileges for SimpleArbiterDhcp<br>
								/srv/nfs/ERLbbBrT 192.168.1.180(rw,sync,insecure)<br>
								/srv/nfs/ERLbbBrT 192.168.1.0/24(ro,sync,insecure)<br>
							</p>
						</li>
						<li>
							Change the owner of the directory and files in it:
							<span id="code">
								chown student /srv/nfs/ERLbbBrT
							</span>
							and similarly for all the files in shared directory. The owner should not be root.
						</li>
						<li>
							Run command 
							<span id="code">exportfs -rv</span>
							 to export file systems
							 <p>After that run
							 	<span id="code">
							 		services nfs-kernel-server restart
							 	</span>
							 </p>
						</li>
						<br>
					</ol>
				</li>
				<a name="smb"></a>
				<li>
					Set up SMB server
					<ol>
						<li>
							<span id="code">
								apt-get install samba
							</span>
						</li>
						<li>
							Create directory urania-03 and set owner and privileges:
							<p id="code">
								mkdir /home/student/urania-03<br>
								chown -R root:users /home/urania-03/<br>
								chmod -R ug+rwx,o+rx+w /home/urania-03<br>
							</p>
						</li>
						<li>
							Edit configurations in /etc/samba/smb.conf, add at the bottom of document, e.g.:
							<p id="code">
							[global]<br>
							workgroup = users<br>
							server string = zarptica-32<br>
							dns proxy = no<br>
							log file = /var/log/samba/log.%m<br>
							max log size = 1000<br>
							syslog = 0<br>
							panic action = /usr/share/samba/panic-action %d		<br>
							security = user<br>
							encrypt passwords = yes<br>
							passdb backend = tdbsam<br>
							obey pam restrictions = yes<br>
							unix password sync = yes<br>
							passwd program = /usr/bin/passwd %u<br>
							passwd chat = *Enter\snew\s*\spassword:* %n\n <br>*Retype\snew\s*\spassword:* %n\n <br>*password\supdated\ssuccessfully* .<br>
							pam password change = yes<br>
							map to guest = bad user<br>
							usershare allow guests = yes<br>
							<br>
							[homes]<br>
							comment = Home Directories<br>
							browseable = no<br>
							read only = yes<br>
							create mask = 0700<br>
							directory mask = 0700<br>
							valid users = %S<br>
							<br>
							[printers]<br>
							comment = ALl Printers<br>
							browseable = no<br>
							path = /var/spool/samba<br>
							printable = yes<br>
							guest ok = no<br>
							read only = yes<br>
							create mask = 0700<br>
							<br>
							[print$]<br>
							comment = Printer Drivers<br>
							path = /var/lib/samba/printers<br>
							browseable = yes<br>
							read only = yes<br>
							guest ok = no<br>
							<br>
							[urania-03]<br>
							comment = All Users<br>
							path = /home/urania-03<br>
							users = @users<br>
							force group = users
							create mask = 0660<br>
							directory mask = 0771<br>
							writable = yes<br>
							</p>
						</li>
						<li>
							Restart Samba: 
							<span id="code">
								service samba restart
							</span>
						</li>
						<li style="list-style-type:none;">
							<p>
								Test the syntax of smb.conf file with command 
								<span id="code">
									testparam
								</span>
							</p>
						</li>
						<li>
							Add users:
							<p>
								In order to define passwords for Samba users they have to exist on a local system, too.
								<p>
									Use command 
									<span id="code">
										useradd USERNAME --shell /bin/false
									</span>
									 to create user with a disabled account and without home directory, e.g:
								<p id="code">
									useradd tester --shell /bin/false
								</p>
							</p>
							<p>
								Define Samba password for your user:
							<p id="code">
								smbpasswd -a tester
							</p>
							<p>
								Add the user to your group.
								<p>
									Open /etc/group file and add group and users:
									<span id="code">
										users:x:1002:tester
									</span>
								</p>
							</p>
							<li> Restart Samba.
							</li>
						</li>
					</ol>
				</li>	
			</ol>
		</li>
		<br>
		<a name="client"></a>
		<li>
			<h3>
				Client SimpleArbiterDhcp
			</h3>
			<ul type="disc">
				<li>Create directories for your mounts, e.g.:
					<p id="code">
						mkdir mnt<br>
						mkdir mnt/smb<br>
						mkdir mnt/nfs<br>
					</p>
				</li>
				<li>
					NFS: Run command
					<p id="code">
						sudo mount 192.168.1.10:/srv/nfs/ERLbbBrT /mnt/nfs
					</p>
				</li>
				<li>
					SMB: Run command
					<p id="code">
						sudo mount -t cifs //192.168.1.10/urania-03 /mnt/smb -o username=tester,password=test,workgroup=users<br>
					</p>
				</li>
				<p>
					You should be able to access shared folders now.
				</p>
			</ul>
		</li>
	</ul>
</body>
</html>