• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install and configure Samba file sharing on Ubuntu 22.04

  • 00:48 lsb_release - a
  • 01:12 sudo apt-get update
  • 01:33 sudo apt install samba
  • 02:11 whereis samba
  • 02:37 mkdir /home/linux/sambashare
  • 03:06 vim /etc/samba/smb.conf
  • 05:23 sudo service smbd restart
  • 05:40 sudo ufw allow samba
  • 06:07 sudo smbpasswd -a linux
  • 06:25 ifconfig
{{postValue.id}}

To Install And Configure Samba File Sharing On Ubuntu 22.04

Introduction

Samba is a widely used open-source software that facilitates seamless communication between Linux and Windows machines within a network. By using a Samba file server, users can easily share files across various operating systems on a network. This enables efficient access to desktop files from different devices and fosters collaboration among Windows and macOS users.

Installation steps:

Step 1: Check the version of the OS by using the below command

root@linuxhelp:~#lsb_release -a 

Step 2: Installing Samba Packages by using the below command

To install Samba, we run:

root@linuxhelp:~#sudo apt -get update
root@linuxhelp:~#sudo apt install samba

Step 3: Checking the Samba package by using the below command

We can check if the installation was successful by running:

root@linuxhelp:~#whereis samba

The following should be its output:

root@linuxhelp:~#samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz

Step 4: Setting up Samba by using the below command

Now that Samba is installed, we need to create a directory for it to share:

root@linuxhelp:~#mkdir /home/username/sambashare/

The command above creates a new folder sambashare in our home directory which we will share later.

Step 5: Adding the configurations file by using the below command

The configuration file for Samba is located at /etc/samba/smb.conf. To add the new directory as a share, we edit the file by running:

root@linuxhelp:~# vim /etc/samba/smb.conf

press i to insert the changes At the bottom of the file, add the following lines:

[sambashare]
    comment = Samba on Ubuntu
    path = /home/username/sambashare
    read only = no
    browsable = yes

Then press Esc to exit from insertion mode and enter :wq to save
comment: A brief description of the share. path: The directory of our share. read only: Permission to modify the contents of the share folder is only granted when the value of this directive is no. browsable: When set to yes, file managers such as Ubuntu’s default file manager will list this share under “Network” (it could also appear as browseable).

Step 6: Restart Samba server by using the below command

Now that we have our new share configured, save it and restart Samba for it to take effect:

root@linuxhelp:~#sudo service smbd restart

Step 7: Allow Samba traffic by using the below command

Update the firewall rules to allow Samba traffic using the command

root@linuxhelp:~#sudo ufw allow samba

Step 8: Setting up User Accounts and Connecting to Share by using the below command

Since Samba doesn’t use the system account password, we need to set up a Samba password for our user account:

root@linuxhelp:~#sudo smbpasswd -a username

Step 9: Connect to Share

On Ubuntu: Open up the default file manager and click Connect to Server then enter:

Screenshot 2024-07-23 005046

output: Enter the credentials and login in to Sambashare

Screenshot 2024-07-23 005121

Conclusion

We have reached the end of this article. In this guide, we have walked you through the steps required to install and configure Samba in Ubuntu 22.04. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is Samba file share?

A

The Samba project provides file sharing and print services for computers on a network.

Q

What is the function of the Samba?

A

Samba allows file sharing between different operating systems by implementing the Server Message Block (SMB) protocol. This enables Windows clients to access shared folders and files on Linux and Unix servers, as if they were accessing resources on a Windows server

Q

What is the purpose of Samba file share?

A

Samba is an extremely useful networking tool for anyone who has both Windows and Unix systems on his network.

Q

Which port does Samba use?

A

SAMBA uses ports 137 – 139 and 445.

Q

What are the features of Samba server?

A

Share one or more directory trees.Share one or more Distributed filesystem (Dfs) trees.
Share printers installed on the server among Windows clients on the network.Assist clients with network browsing. Authenticate clients logging onto a Windows domain.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.