How to Transfer Files Between Linux and Windows via LAN

You’ve tried to use a flash drive or SD card to transfer files from Linux to a Windows computer, and you found it annoying and tiring, especially when there are lots of files to move, and it’s taking ages to complete.

You don’t have to waste your precious time using storage devices when you can move files quickly and easily over your local network (LAN).

The main methods used to do this are:

Create a share in Linux to access it from Windows using Samba

Create a share in Windows to access it from Linux

Create a share in Linux and access it from Windows using Samba

The best and fastest way to do this is by installing the Samba suite. Samba is an ideal solution for sharing files between different devices such as a Windows, Linux or Mac machines. The machines need to be networked with a generic router.

Windows machines come with functionality that allows them to work with Samba out of the box, so you only need to install one package for Linux machines.

1. On your Linux machine open the location containing the files you wish to share.

2. Right-click on the file and select “Sharing Options.”

3. If you get a prompt asking you to install Samba services, click “Install service.”

4. Click Restart session once Samba service is installed to enable sharing.

5. Check the “Share this folder” and “Allow others to create and delete files in this folder” boxes.

Note: the computer name in this case can be the IP address of the Linux machine, which you can find by going to the Linux computer and opening terminal, then typing ipconfig.

13. Type the Linux computer name and share the resource name.

14. A prompt will be displayed asking for your credentials.

15. Type in your Linux username and password. Click OK.

16. Try to access the shares from your Windows computer.

The new server should be displayed in “My Network Places” in Windows.

Alternatively, do the following: right click Start and select Run, then enter: //server. Replace server with the name or IP address of the machine that runs your Samba server. A window with the browsable shares from the server will open.

Note: to access non-browsable shares, use this code: \\server\share name

Create a share in Windows to access it from Linux

This will be done in three steps as follows:

Enable sharing on Windows

Share the folder

Access it from Linux

Enable sharing on Windows

Start by ensuring the network settings are configured to allow a connection from the Linux system. To do this:

4. Enable these two settings: “Network Discovery” and “Turn on file and printer sharing.”

5. Click Save changes.

6. Sharing is now enabled.

Share the folder

Create a shared folder for the Linux system to see, connect and access. You can share anything, so follow these steps:

1. Find the folder you want to share and right-click it.

2. Select “Properties.”

3. Under the Sharing tab, click “Advanced Sharing.”

4. Under the Advanced Sharing window, enable the “Share this folder” option.

5. Click “Permissions.”

Note: in the Permissions window you can restrict access to the folder to specific users or accounts. Select “Full Control permission to Everyone” to give any user access. This way anyone can read and write changes to the files in the folder you share.

If, however, you want to restrict access to specific user accounts, remove the “Everyone” user, add the users you want and then assign the relevant permissions to them. The user accounts are those that are on the Windows system (not the Linux system).

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 similar permissions as those in the sharing settings so that Linux users can access the shared folder.

If they don’t match, the most restrictive settings are applied.

However, if the user you intend to share with already has security permissions, close the window and move to the third step. Otherwise, click “Edit” to add a user, click “Add” in the Permissions window that opens, and enter the user’s details.

9. Click OK on all windows. The folder should now be shared with your network.

Access from Linux

You can mount the shared folder using Linux GUI or by using a command line. For our example we’ll use Terminal because it works across many distributions, and it’s faster.

To do this, you’ll need the cifs-utils package to mount SMB shares. The complete the following steps.

Ebooks

4 comments

Your are kidding or delusional. I’ve never, ever, been able to share anything via samba or anything else using my Ubuntu workstation and Windows PC’s. Installing samba, explicitly following instructions such as those you show above, always — ALWAYS — result in “permission denied” or “file doesn’t exist”. I just keep a spare 32gb micro SD card handy and use it for transfers. It is, appropriately, named “transfers”.

Following on from my last comment, I’ve been able to view Windows Shares in Ubuntu Mate 18.04.1 (32 bit with updates applied) but the key turned out to be a modification of the Samba config file “/etc/samba/smb.conf”, adding the line “client max protocol = NT1” in the section [Global]. Then I was able to see the Windows shares while browsing the network in Caja, the file manager included with Ubuntu Mate. I didn’t have to install cifs-utils, as far as I know. (Thanks to the Dedoimedo website for this tip. The author explains the problem very clearly. :-) )