Linux System Administration

0 of 84 lessons complete (0%)

Network Information System (NIS) and Network File System (NFS)

Installation of Samba Server

You don’t have access to this lesson

Please register or sign in to access the course content.

Samba allows Linux and Windows systems to share files over a network easily. Here’s a simple guide to install and configure it on Ubuntu.


1. Update your system

sudo apt update && sudo apt upgrade -y

2. Install Samba

sudo apt install samba -y

Verify installation:

smbd --version

3. Create a shared folder

Let’s create a directory for sharing:

mkdir ~/sambashare
chmod 777 ~/sambashare

4. Configure Samba

Open the Samba configuration file:

sudo nano /etc/samba/smb.conf

At the bottom, add:

[sambashare]
   path = /home/yourusername/sambashare
   browseable = yes
   read only = no
   guest ok = yes

👉 Replace yourusername with your actual Ubuntu username.

Save and exit (CTRL+O, Enter, CTRL+X).


5. Add a Samba user

Set a Samba password for your system user:

sudo smbpasswd -a yourusername
sudo smbpasswd -e yourusername

6. Restart Samba service

sudo systemctl restart smbd
sudo systemctl enable smbd

7. Allow Samba through firewall

sudo ufw allow samba

8. Access the share

  • From Linux: smbclient //hostname/sambashare -U yourusername
  • From Windows:
    Press Win + R, then type: \\<ubuntu-ip>\sambashare

✅ That’s it! You now have a working Samba setup on Ubuntu, accessible from both Linux and Windows.