Linux mount CIFS Windows Share

by on January 6, 2008 · 9 comments· last updated at November 16, 2008

Q. How do I mount CIFS Windows Server / XP / Vista Shared folder under Linux operating systems?

A. Common Internet File System is an application-level network protocol mainly used to provide shared access to files, printers, serial ports, and miscellaneous communications between nodes on a network. You can easily access CIFS share from Linux and mount them as a regular filesystem.

Mount Linux CIFS share

Mount CIFS with the default local filesystem permissions:
# mkdir /mnt/cifs
# mount -t cifs //server-name/share-name /mnt/cifs -o username=shareuser,password=sharepassword,domain=nixcraft
# mount -t cifs //192.168.101.100/sales /mnt/cifs -o username=shareuser,password=sharepassword,domain=nixcraft

OR
# mount.cifs //192.168.101.100/sales /mnt/cifs -o username=shareuser,password=sharepassword,domain=nixcraft
Where,

  • username=shareuser : specifies the CIFS user name.
  • password=sharepassword : specifies the CIFS password. If this option is not given then the environment variable PASSWD is used. If the password is not specified directly or indirectly via an argument to mount, mount will prompt for a password, unless the guest option is specified.
  • domain=nixcraft : sets the domain (workgroup) of the user


You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 9 comments… read them below or add one }

1 ekram October 29, 2010 at 5:16 am

Hi,
i can mount windows share when using gnome mount.
but if i use CLI then how to mount without password since there is no password required for my windows share..

-EKram

Reply

2 dave November 10, 2010 at 1:14 pm

use the guest option.
….,guest,…..
help is available from the CLI with:
man mount.cifs

Reply

3 suhasini January 12, 2012 at 6:36 am

When i am performing mounting, it giving me error like cifs file system not found

Reply

4 Brad Mccormack February 17, 2012 at 9:00 am

Do you have samba installed?

Reply

5 Préstamos - Republica Dominicana February 28, 2012 at 9:39 pm

Thank you, this article really helped me!

Reply

6 Drew April 12, 2012 at 5:04 pm

How can you specify username/pw in /etc/fstab for automatic mounting?

Reply

7 Arun Mummidi June 12, 2012 at 1:46 pm

@Drew: You can add a line similar to below to /etc/fstab

//WindowsHost/Sharename /LocalMountPoint cifs username=,credentials=/etc/cifsauth{any file},domain=[workgroup/WindowsHostName/Most of the time can be left blank] 0 0

Two zeros at end of line are important as it will prevent boot failure when windows share is unavailable.

Format of credentials file (/etc/cifsauth)
username=
password=

Reply

8 amit bajaj February 22, 2013 at 5:51 am

This article is very helpful can we permanent mount this ??????????????

Reply

9 risha April 19, 2013 at 7:00 am

how to mount a ubuntu share on ubuntu using command line?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: