It is easy enough to shares files on Ubuntu with either a Linux or a windows machine, but it doesn't quite work straight out of the box and it does require a little bit of tweaking.

USB drive

First Install Samba

sudo apt install samba

Then you need to enable the Samba user account, so you can securely login from nother PC.

sudo smbpasswd -a username

Then set the password you want to use to login. After that, type the following command to enable the user.

smbpasswd -e username

Next, add the following to to the smb.conf file. Before you do this it is a good idea to backup your configuration file by typing the following command.

sudo cp /etc/samba/smb.conf{,.backup}

You'll need to open the configuration file in a text editor such as nano. For example you could type: sudo nano /etc/samba/smb.conf then add the following line. Then alter any configurations, such as restricting to your local nextwork by uncommenting the following lines

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
interfaces = eth0
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.

# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
bind interfaces only = yes
name resolve order = lmhosts bcast host wins

To check that the samba server is running tpe the following command

sudo systemctl status smbd

Then ensure that your filewall is configured correctly by running the following command

sudo ufw allow 'Samba'

finally run the testparm command to check that there are no errors in the smb.conf file.

Two share a folder on the network, you need to change the file permissions. Right click on a folder and click on 'Local Network Share'. Then click on 'Share this folder' and select the relevant permissions you want, finally click on create share. This folder will now be discoverable on other Windows & Linux machines.

The default samba permissions to select

If you are sharing between two Linux machines, a more secure and versatile way of sharing files is using SSH.

Preview image by Artturi Mäntysaari from


Comments powered by Disqus