Instructions on how to share data between Windows and Linux via LAN
You tried using a flash drive or SD card to transfer files from Linux to a Windows computer and found it annoying, especially when there are too many files to move and will take a long time to complete. .
Don't waste your precious time on using storage devices anymore! You can move files quickly and easily via the local area network (LAN).
The main methods used to do this are:
- Set up sharing in Linux to access it from Windows with Samba
- Set up sharing in Windows to access it from Linux
How to transfer files between Linux and Windows via LAN
- Set up sharing in Linux and access it from Windows with Samba
- Set up sharing in Windows to access from Linux
- Allow sharing on Windows
- Share folder
- Access from Linux
Set up sharing in Linux and access it from Windows with Samba
The best and fastest way to do this is to install Samba. Samba is an ideal solution for sharing files between different devices such as Windows, Linux or Mac devices. Machines need to be networked with a common router.
Windows computers have a function that allows them to work with Samba, so just install the package for the Linux computer.
1. On a Linux computer, open the location that contains the files you want to share.
2. Right-click the file and select 'Sharing Options'.
3. If you receive a prompt asking to install Samba services, click 'Install service'.
4. Click Restart session after Samba service is installed to allow sharing.
5. Check the 'Share this folder' boxes and 'Allow others to create and delete files in this folder' .
6. Click 'Create Share' to complete the process.
7. Open Terminal and type the following commands:
sudo smbpasswd –a USERNAME
Replace USERNAME with the username.
sudo cp /etc/ samba/ smb.conf /etc/samba/smb.conf.old sudo nano /etc/samba/smb.conf
8. Find the Global section and add the following lines:
encrypt passwords = true wins support = yes
9. Press Ctrl + O and Ctrl + X to save and exit.
10. Restart Samba:
sudo service smbd restart
11. Switch to Windows computer and right-click Start, then select Run.
12. In the Run box , enter the command:
computer_nameshare_name5
Note: The computer name in this case may be the IP address of the Linux machine. You can find this address by going to your Linux computer and opening the terminal, then entering ipconfig.
13. Enter the Linux computer name and share the resource name.
14. A prompt will be displayed asking for login information.
15. Enter your Linux username and password, then click OK.
16. Try accessing the share from your Windows computer.
The new server will be displayed in 'My Network Places' on Windows.
Or do the following: Right-click on Start and select Run, then enter: // server. Replace 'server' with the name or IP address of the Samba server computer. A window with browsable shares from the server will open.
Note : To access shared items that cannot be browsed, use this code:
servershare name
Set up sharing in Windows to access from Linux
This setting will be done in three steps as follows:
- Allow sharing on Windows
- Share folder
- Access directory from Linux
Allow sharing on Windows
Start by making sure the network settings are configured to allow connection from the Linux system. To do this, do the following:
1. Go to Control Panel and click 'Network and Internet'.
2. Select 'Network and Sharing Center' .
3. The Network and Sharing Center window will open. Click 'Change Advanced Settings' .
4. Activate these two settings: 'Network Discovery' and 'Turn on file and printer sharing'.
5. Click Save changes.
6. Sharing feature has been activated.
Share folder
Create a shared folder for the Linux system to view, connect and access. You can share anything, so follow these steps:
1. Find the folder you want to share and right-click on that folder.
2. Select 'Properties'.
3. In the Sharing tab , click 'Advanced Sharing'.
4. In the Advanced Sharing window , activate the 'Share this folder' option .
5. Click 'Permissions'.
Note : In the 'Permissions' window , you can restrict access to folders for specific users or accounts. Select 'Full Control permission to Everyone' to give any user access. This way, anyone can read and write changes to files in the folder you share.
However, if you want to restrict access to specific user accounts, delete 'Everyone' , add desired users and then assign related rights to them. User accounts are accounts on Windows systems (not Linux systems).
6. Click OK to close the Permissions window .
7. Click OK to close the Advanced Sharing window .
8. Go to the Security tab in the main Properties window.
Note : Configure the same permissions as in sharing permissions so that Linux users can access the shared folder.
If the permissions do not match, the most restrictive settings apply.
However, if the user you intend to share has security rights, close the window and go to the third step. If not, click 'Edit' to add users, click 'Add' in the Permissions window and enter user details.
9. Click OK on all windows. The folder will be shared with the network.
Access from Linux
Users can mount the shared folder using the Linux GUI or use a command line. In this example, we will use Terminal because this tool works on many distributions and is faster than using the Linux GUI.
To do this, we need the cifs-utils package to mount the SMB shares. Follow these steps.
1. In the terminal, enter:
sudo apt-get install cifs-utils
2. Create a folder.
3. Mount share to the folder.
4. Create a folder on the desktop. (Will be easier to access from the desktop).
5. Create and mount directories with the following commands:
mkdir ~/Desktop/Windows-Share sudo mount.cifs //WindowsPC/Share/home/username/Desktop/Windows-Share –o user=username
Note : If prompted to enter the Linux system root password and password for the user account on Windows, enter each password and run the command.
You should now see the content of Windows share and will be able to add data to it.
Do you know how to transfer files from a Linux system to Windows and vice versa? If there is another method, please share with us in the comment section below!
Hope you are succesful.
You should read it
- How to share data between Windows, Mac and Linux computers
- Convert data, applications from Windows to Linux in minutes
- Create a wireless connection between two laptops
- Interesting operating systems may be unknown to you
- 'AirDrop' for Windows: How to Use Nearby Sharing in Windows 11
- 12 best Linux server operating systems
- How to Set Up an FTP Server on Ubuntu Linux
- Compare the most popular Linux distributions today
- 8 best open source NAS operating systems for Linux
- How to create dual boot Linux and Windows 10 on Linux
- Instructions for installing Windows Linux Subsystem on Windows 10
- How to Dual Boot Windows 10 and Ubuntu 16.04
Maybe you are interested
How to Listen to FM Radio on Linux
How to switch users on the Linux command line
How to execute Shell script in Linux
AMD Ryzen 9000 CPU runs on Linux for higher performance than Windows 11
New Intel microcode '0x129' tested on Linux, did not show a major impact on performance
How to set up Wireguard VPN on Linux