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
🐧 23 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
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
use the guest option.
….,guest,…..
help is available from the CLI with:
man mount.cifs
When i am performing mounting, it giving me error like cifs file system not found
Do you have samba installed?
Thank you, this article really helped me!
How can you specify username/pw in /etc/fstab for automatic mounting?
@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=
This article is very helpful can we permanent mount this ??????????????
how to mount a ubuntu share on ubuntu using command line?
Works.Supercool Vivek !
mount with write permisssion
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
thanks a lot.
…and what if the folder you’re mounting on the windows share has a space in it? //storageserver/old%20work?
Try:
//storageserver/old\ work
Just in case a formatting problem crops up, that’s backslash space between old and work.
Thanks this helps me more.
file_mode=0777,dir_mode=0777 made the difference, thanks
Hi,
what about if the WIN share has spaces in its name? How do you mount it then?
thanks,
Mark
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
magaranth,
I think this is what you want:
https://wiki.ubuntu.com/MountWindowsSharesPermanently
//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 .
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”
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?