# How to transfer files from Linux to Windows: The SMB network file-sharing protocol

The SMB (Server Message Block) protocol is a widely used network file-sharing protocol that enables users to access and manage shared resources, such as files and printers. Although initially designed for Windows environments, SMB is also supported in Linux operating systems and can transfer files between Windows and Linux computers. This article will explore how to transfer files from a Linux machine to a Windows machine using the SMB protocol.

## Install Samba on Linux

Samba is an open-source software suite that provides file and print services to SMB/CIFS clients. It allows Linux computers to participate in a Windows-based network and supports accessing and sharing files and printers with Windows computers. Samba implements the SMB/CIFS protocol and can create file and printer shares on a Linux machine that can be accessed from Windows computers and access Windows files and printer shares from a Linux machine. This way, Samba enables seamless file and printer sharing between Windows and Linux computers in a mixed-operating system environment.

Install samba:

```bash
sudo apt install samba -y
```

On successful installation, check the smbd status

```bash
systemctl status smbd
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675617411019/95176638-fcda-499c-b303-00d9135a3851.png align="center")

> Replace `wamaitha` with your computer username and change `paths` to suite your needs.

We want to share movies from Linux to Windows. Create a folder that will be the shared folder.

```bash
mkdir /media/wamaitha/data/movies
```

Give full permission to the folder.

```bash
chmod 777 /media/wamaitha/data/MOVIES
```

Create a user that will be associated with the file sharing:

```bash
 useradd sambauser
```

Create an smb password for this user

```bash
smbpasswd -a sambauser
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675617838240/00d16b48-73e7-4696-a497-3748b43159f7.png align="center")

Edit the samba config file using nano or any editor of your choice

```bash
nano /etc/samba/smb.conf 
```

Scroll to the bottom of the config file and add the following:

```bash
[Movies]
path = /media/wamaitha/data/MOVIES
valid users = sambauser
read only = no
browsable = yes
public = yes
writable = yes
browsable = yes
```

Save the file and check if everything was correctly configured using the following command:

```bash
testparm
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675618276936/83f2d787-1320-4a58-a2a0-1aac3eed925c.png align="center")

Check your IP address on the Linux machine using ifconfig:

```bash
ifconfig wlo1
```

On the output, the IP address is shown below:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675626622043/3f024c3a-9520-4768-b6bf-9f8b206f0e40.png align="center")

## Connecting on windows

On windows launch `run` by pressing the `windows logo` + `R` .

Type the IP address of the Linux machine from the ipconfig output with two slashes.

```bash
\\192.168.0.101
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675626246023/1649642e-7b94-4793-a06c-11801f272d6a.png align="center")

This will open the Linux-shared folders.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675626123532/7a8db8a4-f176-46af-8f70-021cfca57db0.png align="center")

You can now access the files in the Movies folder on Linux from windows.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1675627065974/94b6deaf-b137-4d08-b624-57c805b745fe.png align="center")

Resources:

[https://www.samba.org/samba/what\_is\_samba.html](https://www.samba.org/samba/what_is_samba.html)
