How to Access a Windows Share from Linux
You can access a Windows share from Linux using SMB/CIFS, either through your file manager for quick browsing, with smbclient for terminal access, or by mounting the share with mount.cifs for regular use. The best method depends on whether you need temporary access or a persistent network drive you can use like a local folder.
What you need before connecting
Windows file sharing usually uses the SMB protocol, which Linux can work with through Samba tools and the kernel CIFS client. Before you try to connect, make sure the share is reachable on the network and you have the correct username, password, and share path.
- The Windows PC or server is powered on and connected to the same network, or reachable through VPN.
- File sharing is enabled on the Windows side.
- You know the share name, such as
DocumentsorPublic. - You have permission to access that share.
- Your Linux system has the needed SMB tools installed.
On many Linux distributions, the packages you need are called samba-client, cifs-utils, or similar. If you are using a desktop environment, basic SMB support may already be built in.
How to access a Windows share from Linux in a file manager
If you just need to open the share and copy files occasionally, the easiest method is often the graphical file manager. This is the simplest way to access a Windows share from Linux without using the terminal.
- Open your file manager, such as Files, Dolphin, or Nemo.
- Look for a Network or Other Locations section.
- Enter the Windows share address, usually in this format:
smb://hostname/sharenameorsmb://IP-address/sharename. - When prompted, enter your Windows username and password.
- Browse the files and copy what you need.
Example:
smb://192.168.1.50/Shared
This is a good choice when you do not need the share to stay mounted after you close the file manager.
How to connect from the terminal with smbclient
smbclient is useful when you want command-line access without mounting the share. It works a bit like an interactive FTP session for SMB shares.
Basic example:
smbclient //192.168.1.50/Shared -U yourusernameYou will be prompted for the password. Once connected, you can use commands like:
lsto list filescdto change directoriesget filenameto download a fileput filenameto upload a fileexitto leave the session
If the account belongs to a Windows domain, you may need to specify it explicitly:
smbclient //server-name/Shared -U DOMAIN\\yourusernameUse this method when you want to test whether the share is reachable before mounting it.
How to mount a Windows share with mount.cifs
Mounting is the best option if you want the Windows share to behave like a regular folder on your Linux system. After mounting, you can use it from any app that can access local files.
1. Create a mount point
Choose an empty directory where the share will appear:
sudo mkdir -p /mnt/windows-share2. Mount the share
Use the share path and your credentials:
sudo mount -t cifs //192.168.1.50/Shared /mnt/windows-share -o username=yourusernameIf the share requires a password, you will usually be prompted for it. If that does not happen on your system, add password=yourpassword in the options, although using a credentials file is safer.
You can also specify a domain or workgroup:
sudo mount -t cifs //192.168.1.50/Shared /mnt/windows-share -o username=yourusername,domain=WORKGROUP3. Use the mounted folder
Open /mnt/windows-share in your file manager or use it from the terminal as if it were a local directory.
4. Unmount when finished
When you are done, remove the mount cleanly:
sudo umount /mnt/windows-shareHow to save credentials securely
Putting a password directly on the command line can expose it in shell history or process listings. A safer option is to use a credentials file.
Create a file such as ~/.smbcredentials:
username=yourusername
password=yourpassword
domain=WORKGROUPThen restrict access to that file:
chmod 600 ~/.smbcredentialsMount with the credentials file:
sudo mount -t cifs //192.168.1.50/Shared /mnt/windows-share -o credentials=/home/yourlinuxuser/.smbcredentialsThis is usually the better choice if you mount the share often.
When to use SMB version options
Sometimes a Windows share will not connect until you specify an SMB version. This can happen with older servers, NAS devices, or environments with strict compatibility settings.
You may need an option like:
-o vers=3.0or, in some cases:
-o vers=2.1Use the highest version supported by both sides. If one version fails, try another that is still supported by your server. Modern Windows systems typically support SMB 2 and SMB 3, but some older devices behave differently.
Common errors and fixes
If access fails, the issue is often one of a few common problems. This table can help narrow it down quickly.
| Problem | Likely cause | What to try |
|---|---|---|
| Permission denied | Wrong username, password, or share permissions | Check the Windows account, verify share permissions, and confirm whether a domain name is required |
| No such file or directory | Incorrect share name or mount point | Confirm the Windows share name and make sure the Linux mount directory exists |
| Host is down or cannot be reached | Network issue, firewall block, or wrong hostname | Try the IP address instead of the hostname and confirm the device is reachable on the network |
| Protocol negotiation failed | SMB version mismatch | Try a different vers= option, such as 2.1 or 3.0 |
| Mount error(13): Permission denied | Authentication or authorization problem | Check credentials, share permissions, and whether the account has access to the folder |
Other things to check
- Make sure the Windows firewall allows file sharing.
- Confirm that the share is enabled in Windows sharing settings.
- If the server name does not resolve, use the IP address.
- Check whether the account is a local Windows user, Microsoft account, or domain user, since the login format may differ.
How to unmount the share
When you mounted the share manually, unmount it before shutting down or disconnecting the network path. This helps avoid file access problems and locked sessions.
sudo umount /mnt/windows-shareIf the system says the target is busy, close any files or terminals using the mount point and try again.
Choosing the best method
The best way to access a Windows share from Linux depends on your use case.
| Method | Best for | Notes |
|---|---|---|
| File manager | Quick browsing and occasional file copies | Easy to use, usually no setup needed |
smbclient | Command-line access and testing | Good for verifying credentials and connectivity |
mount.cifs | Regular access from multiple apps | Best when you want a mounted folder that behaves like local storage |
Frequently Asked Questions About how to access a windows share from linux
How do I connect to a Windows share from Linux?
Use SMB/CIFS. The simplest options are your file manager with an address like smb://server/share, smbclient from the terminal, or mount.cifs if you want the share mounted as a folder.
How do I mount a Windows network share in Linux?
Create a mount point, then use mount -t cifs with the Windows share path, username, and optional domain or credentials file. If needed, add an SMB version option such as vers=3.0.
What is the command to access an SMB share from Linux?
A common command is smbclient //server/share -U username. If you want a mounted folder instead of an interactive session, use mount -t cifs.
Why can’t Linux access my Windows shared folder?
The most common causes are incorrect credentials, missing permissions on the Windows side, a firewall block, the wrong share name, or an SMB version mismatch.
How do I enter Windows credentials when mounting a share on Linux?
You can pass the username in the mount options and either enter the password when prompted or store it in a protected credentials file. For domain accounts, include the domain name if required.
Is it better to browse a share or mount it?
Browse it in a file manager if you only need temporary access. Mount it if you need the share to behave like a local folder for repeated use or for applications that expect a filesystem path.
Conclusion
To access a Windows share from Linux, start with the simplest method that fits your task. Use a file manager for quick browsing, smbclient for terminal-based access, and mount.cifs when you need a mounted folder for ongoing use. If the connection fails, check credentials, permissions, network reachability, and SMB version settings first, since those are the most common causes.
