Operation Sheet 6: File Server Installation in Linux Using Samba
Operation Sheet 6: File Server Installation in Linux Using Samba
Samba
Objectives: After the end of the activity, the students will be able to:
Procedure:
Samba is freely available, unlike other SMB/CIFS implementations, and allows for
interoperability between Linux/Unix servers and Windows-based clients.
The Windows machine must be in the same workgroup. To check the value in the Windows
machine run the following command at cmd prompt:
netconfig workstation
notepad C:\\Windows\System32\drivers\etc\hosts
There you add the following red line and save the file:
[...]
10.0.4.X server1.tvetinstitute.local server1
sudo -s
Samba is available in the Ubuntu repositories. The first step is to install the Samba Server and its
dependencies with apt.
apt-get install -y samba samba-common python-glade2 system-config-samba
nano /etc/samba/smb.conf
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
Step 3: Create Shared Directory
Then I'll create a directory for the anonymous share.
mkdir -p /samba/anonymous
servicesmbd restart
Now you can access the Ubuntu sharing in Windows by entering "\\server1" in the windows
search field of the menu or use the network browser of the Windows file explorer to connect to
the share.
ls -la /samba/anonymous/
For the password-protected share, I will create a group smbgrp and user till to access the Samba
server. I'll use "howtoforge" as password in this example, please choose a custom and secure
password on your server.
addgroupsmbgrp
useraddtesfaye -G smbgrp
smbpasswd -a till
mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured
chownroot:smbgrp secured
Edit the Samba configuration file and add the following (red) lines at the end of the file:
nano /etc/samba/smb.conf
[...]
[secured]
path = /samba/secured
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
servicesmbd restart
testparm
root@server1:/samba# testparm
Load smbconfig files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Anonymous]"
Processing section "[secured]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions <-- Press Enter
# Global parameters
[global]
netbios name = UBUNTU
server string = Samba Server %v
security = USER
map to guest = Bad User
dns proxy = No
idmapconfig* : backend = tdb
[Anonymous]
path = /samba/anonymous
force user = nobody
read only = No
guest ok = Yes
[secured]
path = /samba/secured
valid users = @smbgrp
read only = No
At the Windows machine, open the "\\server1" network device again, it will request a username
and password now. Enter the user details that you created above. In my case, the values
were user=till and password=howtoforge.
We can check the file at the Ubuntu server like this:
ls -la /samba/secured/