From 8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 Mon Sep 17 00:00:00 2001
From: Timotej Lazar
- VirtualBox | Server | Client | NFS | Samba | DHCP
-
- Set up two virtual computers - SimpleArbiterDhcp and FileServer.
-
- 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.
-
- SimpleArbiterDhcp should have write access to /srv/nfs/ERLbbBrT over NFS.
-
- auto eth1
- INTERFACES="eth1"
-
- authoritative;
- #privileges for SimpleArbiterDhcp After that run
-
- services nfs-kernel-server restart
-
-
- mkdir /home/student/urania-03
- [global]
- Test the syntax of smb.conf file with command
-
- testparam
-
-
- In order to define passwords for Samba users they have to exist on a local system, too.
-
- Use command
-
- useradd USERNAME --shell /bin/false
-
- to create user with a disabled account and without home directory, e.g:
-
- useradd tester --shell /bin/false
-
- smb_nfs
-
-
- Quick guide
-
-
- Instructions
-
-
-
- Download these VM images:
-
-
-
-
-
- VirtualBox Settings:
-
-
-
-
-
-
-
-
-
-
- Server FileServer
-
-
-
-
-
-
-
-
- iface eth1 inet static
- address 192.168.1.10
- netmask 255.255.255.0
- network 192.168.1.0
- broadcast 192.168.1.255
-
- default-lease-time 600;
- max-lease-time 7200;
-
- subnet 192.168.1.0 netmask 255.255.255.0 {
- range 192.168.1.100 192.168.1.200;
- option routers 192.168.1.10;
- option domain-name-servers 193.2.1.66, 8.8.4.4;
-
- host SimpleArbiter {
- hardware ethernet 08:00:27:A2:FB:B4;
- fixed-address 192.168.1.180;
- }
- }
-
-
-
- /srv/nfs/ERLbbBrT 192.168.1.180(rw,sync,insecure)
- /srv/nfs/ERLbbBrT 192.168.1.0/24(ro,sync,insecure)
-
-
-
- chown -R root:users /home/urania-03/
- chmod -R ug+rwx,o+rx+w /home/urania-03
-
- workgroup = users
- server string = zarptica-32
- dns proxy = no
- log file = /var/log/samba/log.%m
- max log size = 1000
- syslog = 0
- panic action = /usr/share/samba/panic-action %d
- security = user
- encrypt passwords = yes
- passdb backend = tdbsam
- obey pam restrictions = yes
- unix password sync = yes
- passwd program = /usr/bin/passwd %u
- passwd chat = *Enter\snew\s*\spassword:* %n\n
*Retype\snew\s*\spassword:* %n\n
*password\supdated\ssuccessfully* .
- pam password change = yes
- map to guest = bad user
- usershare allow guests = yes
-
- [homes]
- comment = Home Directories
- browseable = no
- read only = yes
- create mask = 0700
- directory mask = 0700
- valid users = %S
-
- [printers]
- comment = ALl Printers
- browseable = no
- path = /var/spool/samba
- printable = yes
- guest ok = no
- read only = yes
- create mask = 0700
-
- [print$]
- comment = Printer Drivers
- path = /var/lib/samba/printers
- browseable = yes
- read only = yes
- guest ok = no
-
- [urania-03]
- comment = All Users
- path = /home/urania-03
- users = @users
- force group = users
- create mask = 0660
- directory mask = 0771
- writable = yes
-
- Define Samba password for your user: -
- smbpasswd -a tester -
-- Add the user to your group. -
- Open /etc/group file and add group and users: - - users:x:1002:tester - -
- -
- mkdir mnt
- mkdir mnt/smb
- mkdir mnt/nfs
-
- sudo mount 192.168.1.10:/srv/nfs/ERLbbBrT /mnt/nfs -
-
- sudo mount -t cifs //192.168.1.10/urania-03 /mnt/smb -o username=tester,password=test,workgroup=users
-
- You should be able to access shared folders now. -
-V tej vaji postavimo na linux-u strežnik za nudenje datotek prek mreže in strežnik za SMB, s katerim lahko na Windows sistemih postavimo datoteko v skupno rabo. Pazi da bo simpleArbiterDhcpGW imel NFS pravico pisanja po imeniku!
-Naj ima 2 omrežna vmesnika, prvi naj bo preko NAT povezan na svetovni splet, drugi vmesnik pa naj vsebuje interno povezavo znotraj virtualnih sistemov na tvojem računalniku “intnet”.
-Naj ima 1 omrežni vmesnik, povezan na interno omrežje “intnet”.
-Tokrat imamo tri parametre. “Imenovani” dir, smb-share, smb-server.
-Oziroma iz slike so to:
-Ko zaženemo simpleArbiterDhcpGW in student-fileserver se najprej prijavimo v oba sistema. Nato pa na student-fileserver poženemo
-apt-get update && apt-get install nfs-kernel-server samba
V datoteki /etc/exports
dodamo sledečo vrtstico: /srv/nfs/[dir] [IP simpleArbiterDhcpGW](rw)
.
Datoteko shranimo in znova poženemo NFS strežnik.
-service nfs-kernel-server restart
Ustvarimo imenik, ki smo ga malce prej navedli v nastavitvah NFS. In nato omogočimo vsem pisanje po tem imeniku.
--mkdir /srv/nfs/[dir] -chmod oug+w /srv/nfs/[dir] --
Vse nastavitvene datoteke SMB se nahajajo v imeniku: /etc/samba
. Zanima pa nas datoteka smb.conf
.
# Datoteka smb.conf - [global] - - workgroup = WORKGROUP - netbios name = [smb-server] # Nadomestek DNS, ki si ga je izmislil Microsoft - - # Malce nižje pod vrstico =========== Share Definitions =========== dodamo svoje nastavitve - - [[smb-share]] # Primer iz slike: [aurora-85] - path = /srv/nfs/[dir] - read only = no - guest ok = yes - browseable = yes
Ko popravimo to datoteko restartamo SMB in NetBios s spodnjima ukazoma.
-service smbd restart -service nmbd restart
Sedaj samo še testiranje :) Za to pa na simpleArbiterDhcpGW poženi testno skripto.
-./test_task.py