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)
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 11/26/06


{ 8 comments… read them below or add one }
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
The ‘fmask’ and ‘dmask’ smbfs options are deprecated
Use file_mode and dir_mode instead
Did the above, mount is there, I can acces it, but I can’t dump it to tape
using the dump command.?
Homer
Would someone be so kind as to explain what the:
auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15
part of the fstab is for.
New to Linux, please assume I’m stupid.
read mount man page, it has all info.
man mountThis helped out a lot. Thanks!
I’ve seen so many distributions, there is no one can browse share [though nautilus does, but .. open file in windows share with nautilus is .. nightmare ] or “create a share” like genuine Windows..Just by right mouse click..
mount -t smbfs didn’t work for me on Fedora 7.
The solution is to use: mount -t cifs