Professional Documents
Culture Documents
04 with
Windows Systems
websiteforstudents.com/samba-setup-on-ubuntu-16-04-17-10-18-04-with-windows-systems
When you have both Windows and Ubuntu machines on the same network, you can use
Samba + SMB/CIFS to enable files and printer sharing… This brief tutorial is going to show
students and new users how to get that done..
Samba is an open source software that provides seamless file and print services to
SMB/CIFS clients… Samba enables Linux systems, including Ubuntu to share files with
Windows systems, including Windows 10…
For this tutorial to work, you may want to configure both the Windows and Ubuntu
machines on the same subnet. This means they should be able to communicate over the
network… For this tutorial, we’re going to be using a 192.168.1.0/24 network…
The Windows machine will have IP address 192.168.1.2 and the Linux machine 192.168.1.3
Both machine will also be in the same local workgroup. You can name the workgroup
whatever you want, but for this post, our workgroup will be the default Windows workgroup
called WORKGROUP
Both the Windows and Ubuntu machines will be member of the local workgroup called
WORKGROUP
1/7
To find out which Workgroup Windows machine belongs, open the command prompts and
type the commands below
When you run the commands above, you should see your current Workstation domain
name for the computer… usually called WORKGROUP
notepad C:\\Windows\System32\drivers\etc\hosts
Then add the local entry for the Ubuntu machine to be referenced by the named
ubuntu16.04
To add Windows system name to Ubuntu host file, press Ctrl — Alt –T on your keyboard to
open the command terminal… then run the commands below:
Then type the IP with hostname for Windows machine… and save the file..
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
Next, logon on to the Ubuntu machine to install Samba. To install Samba, run the
commands below.
Copy and paste the content below into the file and save… this will create a share named
Public where everyone will have access on the Ubuntu to it…
3/7
#============================ Global definition ================================
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu1604
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no
bind interfaces only = yes
[Public]
path = /samba/public
writable = yes
guest ok = yes
guest only = yes
read only = no
create mode = 0777
directory mode = 0777
force user = nobody
Set the permissions so that everyone can read and write to it.
Restart Samba and open Windows File Explorer to view the shared location on Ubuntu
Now go to your Windows machine and you should see the shared Public folder on Ubuntu
from when you browse File Manager as shown below…
4/7
Everyone should have access there.
First create a samba group called smbgroup for the share.. only members will have access.
To create a groups in Ubuntu, run the commands below.
Finally, all users who need to access a protected samba share will need to type a
password. To add a user to samba password database, run the commands below for each
user.
The user will be prompted to enter and confirm a password. This password will be used to
access the protected samba shares.
Then give only root and members group access to this share.
cd /samba/
sudo chown -R root:smbgroup protected
sudo chmod -R 0770 protected
When you’re done creating the protected share, go and share it in the smb.conf file.
5/7
sudo nano /etc/samba/smb.conf
Then add configuration block below into smb.conf file just below the one above
[Protected]
path = /samba/protected
valid users = @smbgroup
guest ok = no
writable = yes
browsable = yes
Only member of the smbgroup will be able to access the Protected area…
6/7
Enjoy!
That’s it! This is how to setup Samba to share files with Ubuntu
7/7