This brief tutorial shows you how to easily install and configure Samba file sharing on Ubuntu 14.10. With Samba, one can share files and folders with users on other machines like Windows, Mac OSX or other Linux machines.

The process is pretty easy. Just install Samba and other Samba related tools and start sharing resources. Resources could be printers, CD/DVD drives or files and folders.  Before we get started, here’s what we’re going to do:

  • Create a local host record to point to the server IP (If no DNS systems are in place)
  • Create a local a domain or workgroup and add both the server and client computers in it
  • Enable sharing from the server and allow the clients to access files/folders

For this tutorial, we’re going to name the server SRV01 and assign an IP address 192.168.1.2.

Our clients computer will fall into the same IP subnet using 192.168.1.5 and up. 

The first thing we need to do is verify that all the systems are in the same workgroup, both the servers and clients. To check the workgroup on Windows machines, open the commands prompt and type the command below.

net config workstation

You should see the workgroup it belongs to.. The best ways is to use the current Workgroup Windows machines belong to. The default workgroup is ‘Workgroup‘ so we’re going to be using it on all our systems.

C:\Users\Richard>net config workstation
Computer name                                           \\WIN8
Full Computer name                                    WIN8
User name                                                      Richard
Workstation active on
Software version Windows 8.1 Enterprise
Workstation domain                                   WORKGROUP
Logon domain                                              WIN8
COM Open Timeout (sec) 0
COM Send Count (byte) 16
COM Send Timeout (msec) 250
The command completed successfully.

Next, go and configure the local host records for the client computers if DNS systems are not in place. To do that, open the command prompt as administrator and run the commands below.

notepad C:\Windows\System32\drivers\etc\hosts

That should open the hosts file. Then enter the host record for the server and save.. The format is IP address followed by the the domain name and hostname

192.168.1.2                    SRV01.domain.com                         SRV01

After that, save the file and close out.

Next, logon to Ubuntu server and install Samba and other tools. To install these packages, run the commands below.

sudo apt-get install -y samba samba-common python-glade2 system-config-samba

Next, create a backup of the existing Samba’s configuration file. To do that, run the commands below.

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

After that, create a new Samba config file with the global info below.

sudo vi /etc/samba/smb.conf

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = srvr1
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no

Save the file.

At this point, we have our basic Samba configurations but no shares available. The [global] block above defines what workgroup the server belongs, what security levels is used and what NetBios name to display to clients.

For example, if you wish to share a folder where everyone has access and not security, then follow the steps below.

Create a shared folder called allaccess by running the commands below.

sudo mkdir /samba/allaccess

Then give all users access with full control. To go that run the commands below.

cd /samba
sudo chmod -R 0755 allaccess
sudo chown -R nobody:nogroup allaccess

Next, create a share block called [allaccess] in Samba configuration file as shown below.

[allaccess]
path = /samba/allaccess
browsable = yes
writable = yes
guest ok = yes
read only = no

The configuration file should look like this

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = srvr1
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no
#============================ Share Definitions ==============================
[AllAccess]
path = /samba/allaccess
browsable =yes
writable = yes
guest ok = yes
read only = no

After saving the file, restart Samba using the commands below

sudo service smbd restart

Now you should be able to access the share by browsing using Windows Files Explorer

Samba Configuration in ubuntu

 

To create secured shares so only members of a particular group can access, follow the steps below.

Create a secured folder by running the commands below

sudo mkdir -p /samba/allaccess/secured

Then create the secure group by running the commands below

sudo addgroup securedgroup

After that, give the group full control of the secured folder. To do that, run the commands below

cd /samba/allaccess
sudo chmod -R richard:securegroup secured
sudo chown -R 0770 secured/

After creating the secured folder, go and add another share block in the Samba’s configuration file.

[secured]
path = /samba/allaccess/secured
valid users = @securedgroup
guest ok = no
writable = yes
browsable = yes

Save Samba configuration file after the change above.

Now, only members of the securdgroup will have access to the secured folder. So, to give new member access, just add them to the securedgroup. To do that, run the commands below.

sudo usermod -a -G securedgroup richard

(replace richard with the account name of the user)

For each of the member to have access, he/she must be in Samba access database. To add a user, run the commands below against the username

sudo smbpasswd -a richard

The command above will prompts for a new password. Create and confirm the password. This password will be used to access shares.

Restart Samba database again and all members in the securedgroup should have access to the Secured folder.

sudo service smbd restart

Enjoy!

Frequently Asked Questions

How to install Samba on Ubuntu 14.10?

To install Samba on Ubuntu 14.10, you can use the command 'sudo apt-get install samba'. This will install the necessary packages for Samba file sharing.

What is the purpose of Samba on Ubuntu 14.10?

Samba on Ubuntu 14.10 allows you to share files and folders with users on other machines like Windows, Mac OSX, or other Linux machines. It enables easy file sharing across different operating systems.

How to configure Samba on Ubuntu 14.10 for file sharing?

To configure Samba on Ubuntu 14.10 for file sharing, you need to create a local host record, set up a domain or workgroup, and enable sharing from the server. You can then allow clients to access files and folders.

Can Samba on Ubuntu 14.10 share resources other than files and folders?

Yes, besides files and folders, Samba on Ubuntu 14.10 can also share resources like printers, CD/DVD drives, and other hardware devices connected to the server.

How to add client computers to the Samba workgroup on Ubuntu 14.10?

To add client computers to the Samba workgroup on Ubuntu 14.10, ensure they are in the same workgroup as the server. You can verify the workgroup using commands like 'net config workstation' on Windows machines.

What is the default workgroup setting for Samba on Ubuntu 14.10?

The default workgroup setting for Samba on Ubuntu 14.10 is 'Workgroup'. It is recommended to use the same workgroup setting for all systems to ensure seamless file sharing.

How to assign an IP address to the Samba server on Ubuntu 14.10?

To assign an IP address to the Samba server on Ubuntu 14.10, you can set it manually in the network configuration settings. For example, you can name the server as SRV01 and assign the IP address 192.168.1.2.

What are the benefits of using Samba on Ubuntu 14.10 for file sharing?

Using Samba on Ubuntu 14.10 for file sharing allows easy cross-platform sharing between Windows, Mac OSX, and Linux machines. It simplifies the process of sharing resources like files, folders, printers, and more.