Access Windows Shares from Linux
Q. How do I Access Windows share from Linux command prompt? I would like to be able to access shared folders on Windows machines from my Linux system.
A. There are two ways. Use command line tool called smbclient or you can mount windows shares the mount command. Another option is use GUI tools. Please refer previous articles about access windows share from Linux:
( a ) Mount Windows share using mount command
This is simple way to share data between windows and linux system. You would like to access MS-Windows share called //windowsserver/sharename by mounting to /mnt/win directory under Linux system. Type the following command (replace username, windows server name, share name and password with actual values):
# mkdir -p /mnt/win
# mount -t smbfs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win
# cd /mnt/win
# ls -l
For the share //windowsserver/sharename to be automatically mounted at every system start (after reboot), insert an option in the file /etc/fstab:
# vi /etc/fstab
Append following line (written in a single line)
//windowserver/share /mnt/win smbfs
auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0
Next create the password file /etc/sambapasswords:
# vi /etc/sambapasswords
Now add following content:
username = winntuser
password = mypassword
Save and close the file. Make sure only root can access your file:
# chown 0.0 /etc/sambapasswords
# chmod 600 /etc/sambapasswords
Other solutions
( b ) Browse a Samba or MS Windows share using smbclient
( c ) Browse a Samba or MS Windows share in Nautilus (GUI Option)
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- How do I find the current connections to a Samba server?
- Access NAS server using Windows 2000 or 2003 server
- Access Linux mail server from windows XP
- How to Access the FAT32 files or filesystem from Linux system
- Linux mount ntfs or Access NTFS partition from Linux
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


June 17th, 2008 (4 weeks ago) at 12:05 am
Just to let you know - if you put a space with the equals sign in your credentials file, like this:
username = someuser
password = somepass
it will error out ‘permission denied’
You HAVE to have no spaces on each line like this:
username=someuser
password=somepass