All files accessible in a Linux (and UNIX) system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.
Use the mount command to mount remote windows partition or windows share under Linux as follows:
Procedure to mount remote windows partition (NAS share)
1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux
2) Login to Linux as a root user (or use su command)
3) Create the required mount point:
# mkdir -p /mnt/ntserver
4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver
Use following command if you are using Old version such as RHEL <=4 or Debian <= 3:
# mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver
5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l
Where,
- -t smbfs : File system type to be mount (outdated, use cifs)
- -t cifs : File system type to be mount
- -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
- //ntserver/download : Windows 2000/NT share name
- /mnt/ntserver Linux mount point (to access share after mounting)
See also:
Updated for accuracy on Aug-8-2007, 8:19PM.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 53 comments… read them below or add one }
I Have two Operating System, Windows XP the other is Fedora how can I make them talk to each other, how can I make them file share?
D’Angelo,
Is it a dual boot system or networked system?
Hi,
I have used dual boot system, using Windows 2001 & Red Hat Linux.
1) How make them to speak or share etch other files.
2) How I login Linux & windows without restarting the computer. There is any utility for this.
Regards,
Nandkishor
using -t cifs : File system type to be mount
seams to work better is some cases :-)
example:
mount -t cifs //server/share /mnt –verbose -o user=username
more info:
http://www.die.net/doc/linux/man/man8/mount.cifs.8.html
I tried this command on my Ubuntu system but got the following error:
mount: wrong fs type, bad option, bad superblock on //server_name/Ubuntu_Backups,
missing codepage or other error
In some cases useful info is found in syslog – try
dmesg | tail or so
I also tried nfs but still no good. I have a windows server 2003 machine I am sharing to the ubuntu box.
hii michael
i do help u,,,u install the nfs-comon utility package… then try it…
Use IP address of server, instead of share name. So instead of //ntserver/download, use something like //192.168.24.24/download
Thanks a million!!!!
I had exactly same error and I was not able to find a solution. Then I went through the comment, see your comment and… it works! so simple! like a charm!
Thanks a lot!
Hi,
i have exactly the same issue michael…
Does anyone know, what the problem is?
thanks a lot,
martin
michael / martin,
Use cifs option instead of smbfs (outdated and not supported).
HTH
Martin, Michael, you must have smbfs installed to run cifs, so
$sudo aptitude install smbfs
i did a \\\ and din work (nothing happened, it just stucked)
added –verbose and saw some external ip it’s trying to connect to.
in the end, i did \\192.168.0.164\ and it worked cheerfully….
Awesome, it worked great from my Virtual PC installation of Suse Linux 10.2. Thank you very much.
Hi all,
I have tried the above approach, but it didn’t work. I tried the following approach and it worked
Step 1:
# mkdir -p /mnt/ntserverStep 2: Check what the Windows server is providing with smbclient
# smbclient –L -W -UEg.
# smbclient -L muralidhar12 -W windom -U murali
password:
If the command executes succesfully you will see the name of the shared folder of Windows
Step 3: Mounting the Windows Shared folder
# mount -t cifs : -ousername=,domain=Eg.
# mount -t cifs CORESERVER:F\$ /mnt/temp -ousername=nimda,domain=WINLAB
Password:
If all the steps carried out well, then you will be able to access the share folder.
Step 4: Now every time you restart the system, you have to carry out the Step 3. If you wish you can mount the share folder at startup too. To do this, add the following entry to your /etc/fstab file
MachineName:ShareFolderName /mnt/MountFolderName cifs username=UserName,domain=DomainName,password=Password 0 0
Eg.
TomsComputer:MyShare /mnt/winshare cifs username=tom,domain=work,password=secret 0 0
Hi,
I have one shared folder in my remote desktop (windows XP), I am working in linux server through terminal in my pc. I want to mount that folder to linux server. can you help me.
Thanks in advance……
Thanks a lot. this saved me a bunch of time..
+ Siva +
I have tried for above apporch.But it didn’t work on my pc.Why because i want mount remote windows(win XP OS) partion ntfs in my local linux(fedora 6.0)pc.Please help me.
My official mail id is resudoss@velankani.com
Personal id is raajaacbe@gmail.com
Thanks for you tip. it worked like a charm on clarkconnect community edition.
keep up the good work! and keep posting
This may useful when any one Got this error like
mount -t cifs //hostname/share /mnt/temp -o username=someuser,password=somepassword
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Do like this:
=========
mount -t cifs //amit99.indusa1234.com/abc /mnt/ntserver -o username=indusa1234.com/amitgandhi,password=”tost123490″
This will work… Enjoy
thanks amitgandhi ,
my problem was not putting the password in double quotes; wasted hours figuring this out, shees linux needs some decent docs.
it is very useful to sloved the problems.thanks for all
Dear All,
Please help how to share Windows 2003 Folder and files to a OPENsuse linux11. What is th ecommand. and how to apply. Please help me out.
Thanks to all…
I like the way your censored your password… the first time you referred to it…
This topic is discussed extensively at:
The digest is the following.
Win XP/2003 has built-in firewall that restricts access to SMB share ports (TCP 139, 445) by unusual and non-documented way . Win-to-Win connection to those ports is allowed, while Samba-to-Win is disallowed.
Remedy variants:
1) Disable built-in firewall (this is very bad solution)
2) Disable built-in firewall, install “independent” firewall (this is a good solution, but free firewall suites are not available for Win2003 server)
3) Modify rule for built-in Windows firewall using several mouse clicks (I’d recommend it).
For this, (a) open list of firewall exceptions; (b) locate “File and Print Sharing” item in the list of exceptions and click on its line to select this item; (c) press button “Edit…”; (d) select row “TCP 139″; (e) press button “Change Scope…”; (f) select item “Any computer”.
(g) Press OK; (h) repeat steps d-g for “TCP 445″. Save settings. Be happy.
If the Linux server is behind a Firewall, what ports are required to be opened to connect to a remote Windows Drive?
Thinking of tcp port 137 & 139!!!
Thanks for your help!
See Samba: Linux Iptables Firewall Configuration and What ports need to be open for Samba to communicate with other windows/linux systems?
HTH
Thanks a Lot it worked for me well….
good job simple step to understand :-)
Thank You!! Ive been trying off and on for 2 weeks to get my ubuntu machine to access my windows shares and no luck. Trying the GUI and command line smb connect commands, everything said login failure and/or access denied when I would enter windows credentials. This worked like a charm! As a side note, I was able to setup samba sharing rather quickly and have been able to browse the samba shares from my windows box, but not the other way arround. Not sure what the difference is between the samba GUI and this method, just glad it works (Would love to know why if anyone cares to share).
Thanks,
al
Thank you very much for your clear instructions on the various mount options.
Do you know the settings to allow a linux mount to go through a windows firewall.
i.e. the setting on the firewall.
Regards
Noel
i got samba installed at linux, anything to install in windows?
tried that but got error:
mount: wrong fs type, bad option, bad superblock on //MRCM/downloads,
missing codepage or other error
In some cases useful info is found in syslog – try
dmesg | tail or so
dmesg shows:
CIFS VFS: cifs_mount failed w/return code = -22
tried search above error but solution found not working
“-o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box”
Hi – I think you need to amend the first argument to “username”, not “password”.
Otherwise great tutorial!
- Jason
I got mount with above…command…good.
Cool, it works (Debian -> //WindowsXP/Share) !
Thank you!
hello every one
i am install window xp then i create vartual pc in fedora11. how can i mount windows partition in vartual pc? pls help me?
hmmm… I see, the smbfs command is still working here
I’m using Ubuntu Server and everything works fine.
this is the example command i used before
referenced from your articles as well.
[quote]
$> mount -t smbfs //myTargetWindowsIP/aDirectory /home/myOwnLinuxDirectory -o username=windowsUserName,password=windowsPassword
[/quote]
Enter! Done!
great thanks!
but, anyway, is this permanent?
is it at the time we restart the Linux machine,
we need to RE MOUNT it again?
Nice post, it worked, but what I need is to used the shared content on windows as my repo for my ubuntu, as I read that smb protocol isn’t supported in the /etc/apt/sources.list I figure that mountin the filsystem an put in the sources.list as
deb file:///mnt/ubuntu lucid restricted main
…
but it doesn’t work on apt-update I get this error
Failed to fetch file:/mnt/ubuntu/dists/lucid/restricted/binary-i386/Packages.gz File not found
and some others like this, so how can I use the repository in this way? some ideas?
thanks
To all with the following error: CIFS VFS: cifs_mount failed w/return code = -22
You must install samba-client or the kernel will not know the fs type.
Under CentOS/Redhat variants: yum install samba-client
Note: samba (the server) is not the same as samba-client.
Thanks , it was useful
I was able to mount my windows Filesystem onto linux.
Amazing !
Superb and simple command to share a folder on a linux Box from Windows ..
Thanks a lot !!
Hey, thanks a lot! didn’t know it was this simple to access a windows share on linux.
i have use redhat linux 5 on hyper-v,,then configure the NIS server & create in users..first i wont access user profile every users from window server 2008 create in AD,, i wont my window domain users profile mount at my linux NIS users….am waiting
i have use redhat linux 5 on hyper-v,,then configure the NIS server & create in users..first i wont access user profile every users from window server 2008 create in AD,, i wont my window domain users profile mount at my linux NIS users….
am usesing this command mount -t cifs //ntserver/baljinder -o username=baljinder,password=myPassword /NIS/User/baljinder…but only root user read & wright everything not a baljinder user……pllz tell me any
This procedure worked perfectly for me, as I mounted a Win7-exposed share from a Fedora 14 client. Many, many thanks!!!
I had this problem on CentOS 6:
CIFS VFS: No username specified
CIFS VFS: cifs_mount failed w/return code = -22
Which was happening because mount.cifs could not be found. I resolved this by:
yum install cifs-utils
I actually tried this in mt linux terminal-
mkdir /mnt/ntserver
mount -t cifs /// -o username=user,password=password /mnt/ntserver
and it didn’t work. Am I missing something here?
I actually tried this in mt linux terminal-
mkdir /mnt/ntserver
mount -t cifs //serverip/ -o username=user,password=password /mnt/ntserver
and it didn’t work. Am I missing something here?
**username=Administrator
-o : are options passed to mount command, in this example I had passed two options. First argument is ”””’password ”””’(vivek) and second argument is password to connect remote windows box
above line i think its username not password,
Hi,
my smb client is windows 7, fews are in the workgroup and fews within domain. I’m able to access smb share from windows 7 client. but not able to access windows 7 share from smb server. I’m using RHEL5.
Using the below command.
# mount -t cifs //servername/sharename /mnt/mountpoint \
-o username=myusername,password=mypassword
Error getting: “error “mount error 110 = Connection timed out”.
please suggest.
greate job
+1 to your site! Thanks!
Hi Vivek
Very usefull tip ……
Thanks a lot
Hi all, I have Windows7 host and Backbox as guest using VirtualBox. I want to Access my Windows D drive in Backbox.
So, I ran the command on backbox
root@autobot:/home/ranjeet# mount -t cifs //ntserver/D -o username=ranjeet,password=mypassword /mnt/server
And output was –
mount: wrong fs type, bad option, bad superblock on //ntserver/D,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount. helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so
What should I do?