Connecting Ubuntu and Windows 10 machine

Connecting Ubuntu and Windows 10 machine

It's easier than you think


4 min read

The first thing I wanted to do after setting up a second computer is to connect the Ubuntu and the Windows machine for file transfers. It would feel ridiculous to use a USB stick for this, or an online service like Dropbox. And even though I have absolutely no experience with networks, it turned out that it's not at all a complicated process.

The only thing you need is the Samba package. In your local network, the Ubuntu machine will act as the server, and allow the Windows client to access one or more shared folders. Both computers can read and write to these folders.

๐Ÿ“ฑ Ubuntu Machine

1) Install Samba

sudo apt install samba

After installation, you can check if it's running with:

sudo systemctl status smbd

It should show an entry Active: active (running) and some other details about the process.

2) Create the directory that should be shared

I'm putting it on the Desktop for easy access, and call it shared.

cd ~/Desktop
mkdir shared

3) Edit the smb.conf file

You can find this file in /etc/samba/smb.conf. It's one of those files that a regular user cannot edit due to restricted permissions. If you prefer editing it in an editor instead of using the command line, you have to open the file manager with root privileges:

sudo nautilus

Add the following lines at the end of the file and save:

comment = for windows share
path = /home/<username>/Desktop/shared
read only = no
browsable = yes

4) Configure firewall and restart

Ubuntu comes with a firewall, accessible through the ufw command. I think it was disabled by default on my system, but if you've enabled it (like me), you have to add Samba to the application list, and restart Samba afterwards:

sudo ufw allow samba
sudo service smbd restart

You should find Samba now in the list of applications:

sudo ufw app list

5) Add a user and password

I think this step is necessary because the credentials you'll use to access the Ubuntu machine from the Windows machine have to be configured within Samba. Samba won't automatically know the user's password.

(I'm wildly guessing here ๐Ÿ˜ƒ)

sudo smbpasswd -a <ubuntu_username>

It'll ask you to enter the password for this account.

6) Set permissions

This is done with the chmod command, which is used to change read/write/execute permissions for files and directories. Going into detail would be enough material for another article, but the basic syntax is:

chmod <code> <file_or_directory_name>

To enable full permissions ("everyone can do everything") for the shared folder:

sudo chmod 777 ~/Desktop/shared

7) Find out network address

In order to access the folder from the Windows machine, you have to find out its address (it might be necessary to sudo apt install net-tools first):

sudo ifconfig

This will print some information about the network you're in. Look for an entry inet, it should be something like 192.123.456.78. If you run ipconfig in the terminal of the Windows machine, it'll have the same address with only the last digits being different.

That's it for the Ubuntu part.

๐Ÿ“ฑ Windows part

There's not much to do on Windows now, everything is configured and the Samba server is running and providing the shared folder. We only have to access it.

Open "run" by hitting Windows Key + r and enter the address of the Ubuntu machine, preceded by two back slashes:


You'll be promped to enter the credentials from step 5 above. After a successful login, there should be a folder "Samba-Windows-Share", which is the shared folder on the Ubuntu machine. For convenience, create a shortcut on the Windows desktop if you like.

If everything worked, you should be able to read/write to that folder from both computers now ๐ŸŽ‡

๐Ÿ“ฑ Resources

Configure Samba File Share

๐Ÿ“ฑ Thanks for reading!

If you find any errors or have additions, questions or just want to say hi, please leave a comment below, or get in touch via my website or Twitter.
Keep calm & code ๐Ÿ‘‹