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

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

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron 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
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
68 comments… add one
  • Jango Apr 19, 2016 @ 22:30

    Unmount all files in UNIX.

  • ummer Dec 23, 2015 @ 4:36

    please give me idea what can i do?

  • ummer Dec 20, 2015 @ 15:00

    if i mount it asks only root can do that

  • Gaston Feb 15, 2015 @ 12:31

    From a linux box, I mounted a Windows share using cifs.

    The intend was to “locally” use rsync to backup my windows machine. The command line used to mount the Windows drive is something like:

    mount \192.168.1.74share /cifs1 -t cifs -o noserverino,iocharset=utf8,ro

    Please also note that the drive attached to the linux box is formatted ntfs.

    When doing a sample backup, rsync was always re-copying the directories (names), but not the files. After looking more closely at the “ls -lh ” output at both ends, I noticed that on the linux side the size of the directory level is always 0:

    TTT-Admin@1080-Router:/tmp/mnt/RT-1080/tmp# ls -lh
    drwxrwxrwx 1 TTT-Admi root 0 Feb 8 12:14 DeltaCopy

    but the size of the directory level on the cifs side was always different from 0:

    TTT-Admin@1080-Router:/cifs1/temp/Rsync-Packages# ls -lh

    drwxr-xr-x 1 TTT-Admi root 8.0K Feb 8 12:14 DeltaCopy

    This difference explains why rsync was always recopying directories, but not recopying the folders(which was correct, folder sizes and time stamps being the same on both ends).

    > rsync -av /cifs1/Temp/Rsync-Packages/DeltaCopy /mnt/RT-1080/tmp/rsync
    -av /cifs1/Temp/Rsync-Packages/DeltaCopy /mnt/RT-1080/tmp/

    Is a directory supposed to “have a size” or not ? What should I do to solve this discrepancy ?

  • Stan Huang Dec 26, 2014 @ 6:19

    I installed cifs-utils in my ubuntu 9.04 and use command

    “mount -t cifs //192.168.0.5/rd2 //mnt/samba -o username=rd2,password=,codepage=cp950”, where cp950 is Chinese codepage at Windows.

    It works fine. I did the same at Ubuntu 14.04, it doesn’t work.

    I used command “mount -t cifs //192.168.0.5/rd2 //mnt/samba -o username=rd2,password=,codepage=cp950”, It showed “mount error(22): Invalid argument”.

    I used command “mount -t cifs //192.168.0.5/rd2 //mnt/samba -o username=rd2,password=”, It showed “mount error(13): Permission denied”.

    I used command “”mount -t cifs //192.168.0.5/rd2 //mnt/samba -o username=rd2”, I was prompted to input password. After inputting password, It showed “mount error(13): Permission denied”.

    How come?

  • vinod Nov 22, 2014 @ 5:36

    I am to mount my share Hard Disk Drive on windows xp through the linux file server

    Please give procedure to share disk drive my client system windows xp .

  • Ben Francom Jan 30, 2014 @ 17:10

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

  • GR Jan 2, 2014 @ 22:10

    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?

  • K. Newman Dec 10, 2013 @ 17:40

    Thanks. Succinct and effective.

  • annie Sep 20, 2013 @ 4:43

    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

  • Thirumoorthi Aug 13, 2013 @ 10:31

    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

    • Praveen Sep 3, 2013 @ 7:22

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

  • ranjeet May 10, 2013 @ 5:48

    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?

  • Ken Mar 14, 2013 @ 20:21

    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

  • siddhesh Feb 21, 2013 @ 5:42

    Hi Vivek
    Very usefull tip ……
    Thanks a lot

  • shrirang Sep 4, 2012 @ 7:38

    +1 to your site! Thanks!

  • Muhammad Kamran Apr 3, 2012 @ 6:52

    greate job

  • Sabyasachi Pramanik Jan 13, 2012 @ 13:25

    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.

  • subbu Sep 11, 2011 @ 5:04

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

  • hari Sep 8, 2011 @ 5:58

    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?

    • hari Sep 8, 2011 @ 6:01

      **username=Administrator

  • hari Sep 8, 2011 @ 5:57

    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?

Leave a Reply

Your email address will not be published. Required fields are marked *

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