≡ Menu

Linux mount CIFS Windows Share

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 // /mnt/cifs -o username=shareuser,password=sharepassword,domain=nixcraft

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

  • 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
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 21 comments… add one }

  • ekram October 29, 2010, 5:16 am

    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..


    • dave November 10, 2010, 1:14 pm

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

  • suhasini January 12, 2012, 6:36 am

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

    • Brad Mccormack February 17, 2012, 9:00 am

      Do you have samba installed?

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

    Thank you, this article really helped me!

  • Drew April 12, 2012, 5:04 pm

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

  • Arun Mummidi June 12, 2012, 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)

  • amit bajaj February 22, 2013, 5:51 am

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

  • risha April 19, 2013, 7:00 am

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

  • KaptaiKK June 24, 2013, 7:23 pm

    Works.Supercool Vivek !

  • Sudheer July 17, 2013, 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

  • Sudheer November 1, 2013, 12:28 pm

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

    use ‘\’ if your password contains escape sequence

  • fahad November 3, 2013, 11:45 am

    thanks a lot.

  • ibanez1998 December 9, 2013, 9:01 pm

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

  • Arthur December 18, 2013, 9:12 pm

    //storageserver/old\ work

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

    • Ramesh November 17, 2014, 2:25 pm

      Thanks this helps me more.

  • Rod April 26, 2015, 5:21 am

    file_mode=0777,dir_mode=0777 made the difference, thanks

  • mark May 5, 2015, 6:54 pm


    what about if the WIN share has spaces in its name? How do you mount it then?


  • magaranth May 21, 2015, 7:13 am

    i connect to domain and i can able to login using window domain user.i used to mount (mount -t cifs //server-name/share-name /mnt/cifs -o username=shareuser,password=sharepassword,domain=nixcraft) as root worked fine.
    But i need to mount particular user window domain share folder whenever i login as domain user. how to make fstab entry that can automatically retrieve username and password from login information and mount automatically

  • marshal September 22, 2015, 12:29 am

    // /RMAN/Bck-files cifs user=rman@tt.local,password=2TC@Rman,rw,users,auto,file_mode=0777,dir_mode=0777,uid=oracle,gid=oinstall 0 0
    I write this parameter on fstab and when i start RMAN on oracle user, shown this error “RMAN-03009: failure of backup command on c4 channel at 09/22/2015 03:09:20
    ORA-19504: failed to create file “/RMAN/Bck-files/BCK_LVL1_SVBO_1016_1_891054558″
    ORA-27041: unable to open file
    Linux-x86_64 Error: 13: Permission denied
    Additional information: 3”

    please help me
    I change mount point owner to oracle:oinstall and chmod 777 on it .

Leave a Comment