Linux mount CIFS Windows Share

by on January 6, 2008 · 16 comments· LAST UPDATED November 16, 2008

in , ,

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
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 16 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

10 KaptaiKK June 24, 2013 at 7:23 pm

Works.Supercool Vivek !

Reply

11 Sudheer July 17, 2013 at 9:14 am
mount -t cifs //[netbiosname]/techsupport /mnt/techupport -o username=[username],doamin=[name],rw,file_mode=0777,dir_mode=0777

mount with write permisssion

Reply

12 Sudheer November 1, 2013 at 12:28 pm

Mount in cifs in AIX
mount -v cifs -n 172.16.69.20/gbuilder/builder\!12 -o wrkgrp=commvault-nj /recutstotest /mnt

use ‘\’ if your password contains escape sequence

Reply

13 fahad November 3, 2013 at 11:45 am

thanks a lot.

Reply

14 ibanez1998 December 9, 2013 at 9:01 pm

…and what if the folder you’re mounting on the windows share has a space in it? //storageserver/old%20work?

Reply

15 Arthur December 18, 2013 at 9:12 pm

Try:
//storageserver/old\ work

Just in case a formatting problem crops up, that’s backslash space between old and work.

Reply

16 Ramesh November 17, 2014 at 2:25 pm

Thanks this helps me more.

Reply

Leave a Comment

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

Previous Faq:

Next Faq: