Professional Documents
Culture Documents
Samba Server share on Ubuntu 22.04 Jammy Jellyfish Linux - Linux Tutorials - Learn Linux Configuration
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.
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 Samba
Other Privileged access to your Linux system as root or via the sudo command.
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.
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:
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:
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:
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:
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
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
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
Step 5 Repeat the mounting steps also for the publicly anonymous samba directory share.
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.
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
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
https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux 10/10