How to share files between a Linux and Windows computer

Updated: 03/12/2022 by Computer Hope

The easiest and most reliable way to share files between a Linux and Windows computer on the same local area network is to use the Samba file-sharing protocol. All modern versions of Windows come with Samba installed, and Samba is installed by default on most distributions of Linux.

Create a shared folder on Windows

First, create a shared folder on your Windows computer.


Following the steps below, creates a shared folder on your Windows computer that lets you access files in that folder on your Linux computer. With the right permissions you can also copy, edit, and delete files in that folder from your Linux computer.

  1. Open the Control Panel.
  2. Select the Network and Sharing Options or Network and Sharing Center option.
  3. Click the Change advanced sharing settings link in the left navigation menu.
  4. Click the Turn on Network Discovery and Turn on File and Print Sharing options.
  5. Click the Save changes button at the bottom of the Advanced sharing settings window.

Now, create a new folder to share or choose an existing folder that you want to share.

  1. Right-click the folder and select Properties.
  2. Go to the Sharing tab.
  3. To share the folder with another Windows account, click the Share button, add the account to grant permission to access the shared folder, and click the Share button.

If you shared the folder with another Windows account, you must click the Advanced Sharing button, then click the Permissions button. Select the account, check the Allow box for the Change or Modify permission, and click OK.

  1. Click the Advanced Sharing button.
  2. On the Advanced Sharing window, check the box for Share this folder and click OK.
  3. The network path for the folder is now displayed above the Share button, indicating that it is now a shared folder. For example, it may look like \\YOURCOMPUTERNAME\Users\YourUserName\ShareFolderName. Make a note of this network folder path to use later on your Linux machine.

Access a Windows shared folder from Linux using Konqueror

Many Linux distributions use the KDE (K Desktop Environment) and the Konqueror file manager/browser. If you're using this, you can follow these steps to access your Windows shared folder.

  1. Click the K menu icon.
  2. Select Internet -> Konqueror.
  3. In the Konqueror window that opens, click the Network Folders link, or type remote:/ in the address bar and press Enter.
  4. Click the Samba Shares icon.
  5. Click the icon of your Windows Home workgroup.
  6. Click the Workgroup icon.
  7. Click the icon for your computer.
  8. When prompted, enter the username and password for the Windows account that created the share.
  9. Click OK.

Access a Windows shared folder from Linux using Nautilus

Many Linux distributions, especially those that use the GNOME desktop environment, use the Nautilus file manager. If you're using this, you can follow these steps to access your Windows shared folder.

  1. Open Nautilus.
  2. From the File menu, select Connect to Server.
  3. In the Service type drop-down box, select Windows share.
  4. In the Server field, enter the name of your computer.
  5. Click Connect.

Alternatively, in the Nautilus address bar, you can type smb://ComputerName/ShareName and press Enter. For example, when you created your Windows Share if the share name was listed as:


Type smb://YOURCOMPUTERNAME/Users/YourUserName/ShareFolderName and press Enter. Note the smb: at the beginning, in Linux, use forward slashes instead of backslashes.

Access a Windows shared folder from Linux using the command line

You can also access your Windows shared folder from the Linux command line using the smbclient program.

  1. Open a terminal.
  2. Type smbclient at the command prompt.
  3. If you receive a "Usage:" message, smbclient is installed, and you can skip to the next step. However, if the command is not found, you must install smbclient. Follow these steps to install it.

    1. If you use the apt package manager, the default on Linux systems such as Ubuntu or Debian, you can use the sudo apt-get install smbclient command.
    2. If you use the yum package manager, the default on Linux systems, such as CentOS, you can use the sudo yum install samba-client command.
    3. You can also download the Samba client directly at, which might be useful to you if you need or want to compile the program from the source code.
  4. With smbclient installed, you can connect to your Windows share using the command smbclient //ComputerName/ShareName -U Username. For instance, if your Windows username is Fred, and your Windows share network name is \\YOURCOMPUTERNAME\Users\YourUserName\ShareFolderName, use the command smbclient //YOURCOMPUTERNAME/Users/YourUserName/ShareFolderName -U Fred. Notice that the Linux command uses forward slashes instead of backslashes).
  5. Enter your password.
  6. Once authenticated, you are placed at an smb: \> prompt.
  7. Here, you can use the ls or dir command to list files.
  8. Use the command get filename.ext to transfer a file named filename.ext from your Windows share to your Linux machine, for example. If the file name contains spaces, make sure to enclose it in double quotes, for example: get "My new file.txt".
  9. Type help for a listing of further commands.
  10. Type quit or exit to return to the command prompt.