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.

ADVERTISEMENTS

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
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdig host ip nmap
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w

ADVERTISEMENTS
23 comments… add one
  • ekram Oct 29, 2010 @ 5:16

    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

    • dave Nov 10, 2010 @ 13:14

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

  • suhasini Jan 12, 2012 @ 6:36

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

    • Brad Mccormack Feb 17, 2012 @ 9:00

      Do you have samba installed?

  • Préstamos - Republica Dominicana Feb 28, 2012 @ 21:39

    Thank you, this article really helped me!

  • Drew Apr 12, 2012 @ 17:04

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

  • Arun Mummidi Jun 12, 2012 @ 13:46

    @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=

  • amit bajaj Feb 22, 2013 @ 5:51

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

  • risha Apr 19, 2013 @ 7:00

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

  • KaptaiKK Jun 24, 2013 @ 19:23

    Works.Supercool Vivek !

  • Sudheer Jul 17, 2013 @ 9:14
    mount -t cifs //[netbiosname]/techsupport /mnt/techupport -o username=[username],doamin=[name],rw,file_mode=0777,dir_mode=0777

    mount with write permisssion

  • Sudheer Nov 1, 2013 @ 12:28

    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

  • fahad Nov 3, 2013 @ 11:45

    thanks a lot.

  • ibanez1998 Dec 9, 2013 @ 21:01

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

  • Arthur Dec 18, 2013 @ 21:12

    Try:
    //storageserver/old\ work

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

    • Ramesh Nov 17, 2014 @ 14:25

      Thanks this helps me more.

  • Rod Apr 26, 2015 @ 5:21

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

  • mark May 5, 2015 @ 18:54

    Hi,

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

    thanks,
    Mark

  • magaranth May 21, 2015 @ 7:13

    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 Sep 22, 2015 @ 0:29

    //192.168.1.60/RMAN-Backup/BO_Rman /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 .

  • fix Jul 17, 2016 @ 10:46

    Seems some shares requires to use “user” instead of “username” in

    “username=shareuser,password=sharepassword,domain=nixcraft”

    replace username with user like this:

    “user=shareuser,password=sharepassword,domain=nixcraft”

  • selvapriya Aug 24, 2016 @ 12:07

    I have followed the below steps to mount share on debian linux. But i am getting an error as
    “mount error: cifs filesystem not supported by the system
    mount error(19): No such device
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    1. Shard one folder/drive in hyper-v.
    2. Installed cifs-utils on debian linux VM
    3. mount -t cifs //hostname/sharedname localmountpoint -o username=”username”,password=”password”,domain=”domain ”

    The above credentials are hyper-v credentials. Is anything i am missing here?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.