How to mount remote windows partition (windows share) under Linux

by on April 26, 2004 · 62 comments· LAST UPDATED August 3, 2007

in , ,

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.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 62 comments… read them below or add one }

1 D'Angelo February 2, 2007 at 12:40 am

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?

Reply

2 nixCraft February 2, 2007 at 3:23 am

D’Angelo,

Is it a dual boot system or networked system?

Reply

3 Nandkishor May 8, 2007 at 7:31 am

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

Reply

4 nadav May 8, 2007 at 1:57 pm

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

Reply

5 michael August 2, 2007 at 12:32 pm

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.

Reply

6 baljinder May 14, 2011 at 10:54 am

hii michael

i do help u,,,u install the nfs-comon utility package… then try it…

Reply

7 jolster November 10, 2012 at 2:56 am

Use IP address of server, instead of share name. So instead of //ntserver/download, use something like //192.168.24.24/download

Reply

8 JC April 3, 2013 at 10:30 am

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!

Reply

9 martin August 3, 2007 at 11:50 am

Hi,

i have exactly the same issue michael…
Does anyone know, what the problem is?

thanks a lot,

martin

Reply

10 nixCraft August 3, 2007 at 2:51 pm

michael / martin,

Use cifs option instead of smbfs (outdated and not supported).

HTH

Reply

11 franco November 28, 2007 at 7:56 pm

Martin, Michael, you must have smbfs installed to run cifs, so

$sudo aptitude install smbfs

Reply

12 adam July 17, 2008 at 1:47 am

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

Reply

13 Gerardo Costilla August 21, 2008 at 5:41 pm

Awesome, it worked great from my Virtual PC installation of Suse Linux 10.2. Thank you very much.

Reply

14 Muralidhar September 12, 2008 at 6:22 pm

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/ntserver

Step 2: Check what the Windows server is providing with smbclient # smbclient –L -W -U

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

Reply

15 sampath July 1, 2010 at 9:11 am

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

Reply

16 siva October 7, 2011 at 9:52 am

Thanks a lot. this saved me a bunch of time..

+ Siva +

Reply

17 Raja.E September 19, 2008 at 11:21 am

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

Reply

18 LH October 7, 2008 at 6:08 pm

Thanks for you tip. it worked like a charm on clarkconnect community edition.
keep up the good work! and keep posting

Reply

19 amitgandhi February 17, 2009 at 7:28 am

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

Reply

20 frustrated February 19, 2009 at 7:01 am

thanks amitgandhi ,

my problem was not putting the password in double quotes; wasted hours figuring this out, shees linux needs some decent docs.

Reply

21 G.karthick.,B.E(manamadurai) April 8, 2009 at 7:42 am

it is very useful to sloved the problems.thanks for all

Reply

22 Jaiprakash April 24, 2009 at 5:41 am

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…

Reply

23 Nathan April 24, 2009 at 9:39 am

I like the way your censored your password… the first time you referred to it…

Reply

24 Nick October 28, 2009 at 2:51 pm

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.

Reply

25 Stephane October 28, 2009 at 7:32 pm

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!

Reply

26 nixCraft October 28, 2009 at 7:50 pm

See Samba: Linux Iptables Firewall Configuration and What ports need to be open for Samba to communicate with other windows/linux systems?

HTH

Reply

27 Rajesh Varma November 4, 2009 at 3:27 pm

Thanks a Lot it worked for me well….
good job simple step to understand :-)

Reply

28 al February 23, 2010 at 5:32 am

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

Reply

29 Anonymous May 13, 2010 at 4:07 pm

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

Reply

30 dee May 14, 2010 at 7:02 am

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

Reply

31 Jason May 17, 2010 at 12:18 pm

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

Reply

32 Satya June 4, 2010 at 5:27 am

I got mount with above…command…good.

Reply

33 VicOEM August 18, 2010 at 10:04 am

Cool, it works (Debian -> //WindowsXP/Share) !
Thank you!

Reply

34 jay September 8, 2010 at 7:58 am

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?

Reply

35 g September 22, 2010 at 2:54 am

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?

Reply

36 Julio Cesar October 6, 2010 at 7:37 pm

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

Reply

37 Devious October 19, 2010 at 3:31 am

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.

Reply

38 Oz N November 1, 2010 at 3:22 pm

In my organization we have a windows shared folder that people can drop files too.
I want to access it from my Debian.
The Internet is full with guides that show how to do it, but with and .
In our organization they don’t require a user and pass to access this folder, and the GUI tool of gnome, expects me to type in a user name and pass, but there simply isn’t.

So I tried with the following command:
sudo mount -t cifs //iif00/Institut /home/oz/win/

I get the following error:
mount: wrong fs type, bad option, bad superblock on //iif00/Institut,
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

dmesg tail shows:
[ 152.030382] CIFS VFS: cifs_mount failed w/return code = -22

I Installed samba-client via apt-get and restarted the computer, but I still get an error.

Ideas would be great !
Thanks in advance.

Reply

39 Oz N November 1, 2010 at 3:25 pm

Well, I helped myself via google:

Solution to “cifs_mount failed w/return code = -22″

When trying to mount my network drive from campus at home I received the following message in dmesg:
view source
print?
1 CIFS VFS: cifs_mount failed w/return code = -22

Well it turns out that I needed to have the smbfs package installed. This quickly solved my problem.
view source
print?
1 sudo apt-get install smbfs

Reply

40 prakash February 5, 2011 at 9:11 pm

Thanks , it was useful
I was able to mount my windows Filesystem onto linux.

Reply

41 Parvathy February 9, 2011 at 11:46 am

Amazing !

Superb and simple command to share a folder on a linux Box from Windows ..

Thanks a lot !!

Reply

42 Sreeram March 23, 2011 at 10:59 pm

Hey, thanks a lot! didn’t know it was this simple to access a windows share on linux.

Reply

43 baljinder May 14, 2011 at 11:42 am

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

Reply

44 baljinder May 14, 2011 at 11:50 am

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

Reply

45 Eric June 29, 2011 at 2:23 am

This procedure worked perfectly for me, as I mounted a Win7-exposed share from a Fedora 14 client. Many, many thanks!!!

Reply

46 Alastair Battrick August 17, 2011 at 3:20 pm

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

Reply

47 hari September 8, 2011 at 5:57 am

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?

Reply

48 hari September 8, 2011 at 5:58 am

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?

Reply

49 hari September 8, 2011 at 6:01 am

**username=Administrator

Reply

50 subbu September 11, 2011 at 5:04 am

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

Reply

51 Sabyasachi Pramanik January 13, 2012 at 1:25 pm

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.

Reply

52 Muhammad Kamran April 3, 2012 at 6:52 am

greate job

Reply

53 shrirang September 4, 2012 at 7:38 am

+1 to your site! Thanks!

Reply

54 siddhesh February 21, 2013 at 5:42 am

Hi Vivek
Very usefull tip ……
Thanks a lot

Reply

55 Ken March 14, 2013 at 8:21 pm

These mount procedures work for me but after mounting you have be be root to do any thing. Can’t even do an ls without sudo prefacing. Also I can’t chown or chmod, even as root.

Any ideas?

Thanks,
Ken

Reply

56 ranjeet May 10, 2013 at 5:48 am

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?

Reply

57 Thirumoorthi August 13, 2013 at 10:31 am

hey i got an error during the following process

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Plz anyone help me

Reply

58 Praveen September 3, 2013 at 7:22 am

use the below command:
mount.cifs //server/share /localfolder -o user=,dom=,pass=

Reply

59 annie September 20, 2013 at 4:43 am

Im trying to mount to my share on my windows 7 pc using
mnt -t cifs //Ipaddress /share name /mnt -o username=domain/administrator.name
but comes up mnt not command when I use mount -t cifs //Ipaddress /share name /mnt -o username=domain/administrator.name

displays all the mount functions and want proceed any suggestions

Reply

60 K. Newman December 10, 2013 at 5:40 pm

Thanks. Succinct and effective.

Reply

61 GR January 2, 2014 at 10:10 pm

Hi,

Happy New Year!!!

I am trying to mount my share on win 2003, from zyxel NSA320, and I get message:
ls: cannot open directory .: Value too large for defined data type

Does anybody knows what is the problem?

Reply

62 Ben Francom January 30, 2014 at 5:10 pm

Thank you Muralidhar!
I was able to mount a CIFS share from a newer Netapp Filer using those instructions.

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous post:

Next post: