You are on page 1of 10

4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.

Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Ubuntu Debian Redhat / CentOS / AlmaLinux Fedora Kali Linux

How to configure Samba Server share on Ubuntu


22.04 Jammy Jellyfish Linux
8 March 2022 by Korbin Brown

File servers often need to accommodate a variety of different client systems. Running Samba on
Ubuntu 22.04 Jammy Jellyfish allows Windows systems to connect and access files, as well as
other Linux systems and MacOS. An alternative solution would be to run an FTP/SFTP server on
Ubuntu 22.04, which can also support the connections from many systems.

The objective of this tutorial is to configure a basic Samba server on Ubuntu 22.04 Jammy
Jellyfish to share user home directories as well as provide read-write anonymous access to
selected directory.

There are myriads of possible other Samba configurations, however the aim of this guide is to
get you started with some basics which can be later expanded to implement more features to
suit your needs. You will also learn how to access the Ubuntu 22.04 Samba server from a
Windows system.

In this tutorial you will learn: Sponsored Video

SPONSORED BY ADVERTISING PARTNER


How to install Samba server
How to configure basic Samba share
How to share user home directories and public anonymous directory
How to mount Samba share on MS Windows 10

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 1/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux

Software Requirements and Linux Command Line Conventions

Category Requirements, Conventions or Software Version Used

System Ubuntu 22.04 Jammy Jellyfish

Software Samba

Other Privileged access to your Linux system as root or via the sudo command.

# – requires given linux commands to be executed with root privileges either


directly as a root user or by use of sudo command
Conventions
$ – requires given linux commands to be executed as a regular non-privileged
user

How to configure Samba Server share on Ubuntu 22.04 step by step


instructions

Step 1 Let’s begin by installation of the Samba server. This is a rather trivial task. First, open a
command line terminal and install the tasksel command if it is not available yet on your
Ubuntu 22.04 system. Once ready, use tasksel to install the Samba server.

$ sudo apt update


$ sudo apt install tasksel
$ sudo tasksel install samba-server

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 2/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Step 2 We will be starting with a fresh clean configuration file, while we also keep the default
config file as a backup for reference purposes. Execute the following Linux commands to make
a copy of the existing configuration file and create a new /etc/samba/smb.conf configuration
file:

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup


$ sudo bash -c 'grep -v -E "^#|^;" /etc/samba/smb.conf_backup | grep . > /etc/samba

Step 3 Samba has its own user management system. However, any user existing on the samba
user list must also exist within the /etc/passwd file. If your system user does not exist yet,
hence cannot be located within /etc/passwd file, first create a new user using the useradd
command before creating any new Samba user. Once your new system user eg. linuxconfig
exits, use the smbpasswd command to create a new Samba user:

$ sudo smbpasswd -a linuxconfig


New SMB password:
Retype new SMB password:
Added user linuxconfig.

Step 4 Next step is to add the home directory share. Use your favourite text editor, ex. atom,
sublime, to edit our new /etc/samba/smb.conf Aamba configuration file and add the following
lines to the end of the file:

[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0700
directory mask = 0700
valid users = %S

Step 5 Optionally, add a new publicly available read-write Samba share accessible by
anonymous/guest users. First, create a directory you wish to share and change its access
permission:

$ sudo mkdir /var/samba


$ sudo chmod 777 /var/samba/

Step 6 Once ready, once again open the /etc/samba/smb.conf samba configuration file and
add the following lines to the end of the file:

[public]
comment = public anonymous access
path = /var/samba/
browsable =yes
create mask = 0660
directory mask = 0771
writable = yes
guest ok = yes

Step 7 Check your current configuration. Your /etc/samba/smb.conf samba configuration file
should at this stage look similar to the one below:

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 3/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

1 [global]
2 workgroup = WORKGROUP
3 server string = %h server (Samba, Ubuntu)
4 log file = /var/log/samba/log.%m
5 max log size = 1000
6 logging = file
7 panic action = /usr/share/samba/panic-action %d
8 server role = standalone server
9 obey pam restrictions = yes
10 unix password sync = yes
11 passwd program = /usr/bin/passwd %u
12 passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:*
13 pam password change = yes
14 map to guest = bad user
15 usershare allow guests = yes
16 [printers]
17 comment = All Printers
18 browseable = no
19 path = /var/spool/samba
20 printable = yes
21 guest ok = no
22 read only = yes
23 create mask = 0700
24 [print$]
25 comment = Printer Drivers
26 path = /var/lib/samba/printers
27 browseable = yes
28 read only = yes
29 guest ok = no
30 [homes]
31 comment = Home Directories
32 browseable = yes
33 read only = no
34 create mask = 0700
35 directory mask = 0700
36 valid users = %S
37 [public]
38 comment = public anonymous access
39 path = /var/samba/
40 browsable =yes
41 create mask = 0660
42 directory mask = 0771
43 writable = yes
44 guest ok = yes

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 4/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Step 8 Our basic Samba server configuration is done. Remember to always restart your samba
server, after any change has been done to /etc/samba/smb.conf configuration file:

$ sudo systemctl restart smbd

Step 9 (optional) Let’s create some test files. Once we successfully mount our Samba shares,
the below files should be available to our disposal:

$ touch /var/samba/public-share
$ touch /home/linuxconfig/home-share

Access Ubuntu 22.04 Samba share from MS Windows


Step 1 At this stage we are ready to turn our attention to MS Windows. Mounting network
drive directories might be slightly different for each MS Windows version. This guide uses MS
Windows 10 in a role of a Samba client. To start, open up your Windows Explorer then right
click on Network and click on Map network drive... tab.

Map network drive option on MS Windows

Step 2 Next, select the drive letter and type Samba share location which is your Samba server
IP address or hostname followed by the name of the user’s home directory. Make sure you tick
Connect using different credentials if your username and password is different from
Samba one created with the smbpasswd command on Ubuntu 22.04.

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 5/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Select network folder configuration options and click Next

Step 3 Enter Samba user’s password as created earlier on Ubuntu 22.04.

Enter Samba password

Step 4 Browse user’s home directory. You should be able to see the previously created test file.
As well as you should be able to create new directories and files.
https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 6/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

The home directory is browsable, with read and write permissions

Step 5 Repeat the mounting steps also for the publicly anonymous samba directory share.

Mount the public Samba directory to a different drive letter in Windows

Step 6 Confirm that you can access the Public samba share directory.

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 7/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Connected to the public Samba share and the test file is viewable

All done. Now feel free to add more features to your Samba share server configuration.

Closing Thoughts

In this tutorial, we learned how to install Samba on Ubuntu 22.04 Jammy Jellyfish Linux. We also
saw how to create a Samba share, a Samba user, and configure read and write access. Then, we
went over the steps to connect to our Samba server from a client machine running MS Windows.
Using this guide should allow you to create a file server that can host connections from various
operating systems.

Related Linux Tutorials:


How to setup FTP/SFTP server and client on AlmaLinux
How to install macOS theme on Ubuntu 20.04 Focal Fossa Linux
How to install macOS theme on Ubuntu 22.04 Jammy Jellyfish…
How to setup SFTP server on Ubuntu 20.04 Focal Fossa Linux
How to setup SFTP server on Ubuntu 22.04 Jammy Jellyfish…
FTP client list and installation on Ubuntu 22.04 Linux…
FTP client list and installation on Ubuntu 20.04 Linux…
Things to do after installing Ubuntu 22.04 Jammy Jellyfish…
How to connect to an FTP server using Python
Things to install on Ubuntu 22.04

Ubuntu, Ubuntu 22.04

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 8/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

administration, development, server, ubuntu


How to Open/Allow incoming firewall port on Ubuntu 22.04 Jammy Jellyfish
How to install GCC the C compiler on Ubuntu 22.04 LTS Jammy Jellyfish Linux

NEWSLETTER TAGS FEATURED TUTORIALS LATEST TUTORIALS


Subscribe to Linux Career 18.04 VIM tutorial for beginners How to install OnlyOffice
Newsletter to receive latest news, How to install the NVIDIA Desktop Editors on Linux
jobs, career advice and featured administration drivers on Ubuntu 20.04 Focal How to backup and restore an
configuration tutorials. applications backup
apache Fossa Linux xfs filesystem using xfsdump
and xfsrestore
bash beginner browser Bash Scripting Tutorial for
SUBSCRIBE centos centos8 Beginners Ubuntu Pro vs Ubuntu Free

How to check CentOS version QEMU vs VirtualBox: What’s


commands database
the difference?
How to find my IP address on
WRITE FOR US debian desktop Ubuntu 20.04 Focal Fossa QEMU vs KVM hypervisor:
development docker Linux What’s the difference?
LinuxConfig is looking for a technical
writer(s) geared towards GNU/Linux fedora filesystem firewall Ubuntu 20.04 Remote Desktop Share your desktop screen
gaming gnome Hardware Access from Windows 10 with VNC on Linux
and FLOSS technologies. Your articles
will feature various GNU/Linux installation java kali Howto mount USB drive in How to install KDE plasma
configuration tutorials and FLOSS Linux Desktop on Fedora Linux
manjaro multimedia
technologies used in combination
How to install missing ifconfig Kubuntu vs Fedora KDE
with GNU/Linux operating system.
networking nvidia
command on Debian Linux plasma desktop
programming python
AMD Radeon Ubuntu 20.04 Curl command not found
When writing your articles you will redhat rhel8 scripting
Driver Installation How to clone a Linux system
be expected to be able to keep up with security server ssh
a technological advancement Ubuntu Static IP configuration How to add new disk to
storage terminal
regarding the above mentioned How to use bash array in a existing Linux system
technical area of expertise. You will ubuntu ubuntu shell script How to format data with
work independently and be able to
produce at minimum 2 technical
20.04 video virtualization Linux IP forwarding – How to Column in Linux

webapp webserver Disable/Enable How to keep configuration


articles a month.
How to install Tweak Tool on files under version control
Ubuntu 20.04 LTS Focal Fossa with Etckeeper
APPLY NOW ABOUT US Linux
Curl command basics tutorial
How to enable/disable firewall with examples
on Ubuntu 18.04 Bionic Beaver
How to upgrade Ubuntu from
Linux
22.04 to 22.10
Netplan static IP on Ubuntu How to integrate dialog boxes
configuration in shell scripts with Whiptail
How to change from default to
How to list and manage files
alternative Python version on attributes on Linux
Debian Linux

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 9/10
4/12/22, 10:03 How to configure Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration

Set Kali root password and Check RPM package


enable root login dependencies on
Rhel/Centos/Rocky
How to Install Adobe Acrobat
Reader on Ubuntu 20.04 Focal Check DEB package
Fossa Linux dependencies on Ubuntu /
Debian
How to install the NVIDIA
drivers on Ubuntu 18.04 Full disk Encryption with
Bionic Beaver Linux VeraCrypt on Ubuntu Linux

How to check NVIDIA driver


version on your Linux system

Nvidia RTX 3080 Ethereum


Hashrate and Mining
Overclock settings on HiveOS
Linux

© 2022 TOSID Group Pty Ltd - LinuxConfig.org

https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 10/10

You might also like