HowTo: Mount Remote Windows Partition (Share) under Linux

The article describes how to mount CIFS shares manually. The shares can be on a Windows computer or on a Linux/UNIX server running Samba.

Prerequisites

1. Install cifs-utils, if it hasn’t been installed yet.

This package contains tools for mounting shares on Linux using the SMB/CIFS protocol.

# yum install cifs-utils
# sudo apt-get install cifs-utils

2. Check that NetBIOS service is running and reachable on the remote host.

Port 139 TCP – NetBIOS (Windows File and Printer Sharing).
It allows applications on separate computers to communicate over a local area network.

You can test it with telnet or nmap.

# nmap -p T:139 172.16.10.1
Nmap scan report for 172.16.10.1
Host is up (0.0011s latency).
PORT    STATE SERVICE
139/tcp open  netbios-ssn
MAC Address: 00:00:00:00:00:00 (Unknown)

# telnet 172.16.10.1 139
Trying 172.16.10.1...
Connected to 172.16.10.1.
Escape character is '^]'.

Mounting Remote Windows Share

Run all commands as root (use sudo).

Create mount point

# mkdir -p /mnt/win

Mount password protected network folder

# mount -t cifs //IP/SHARE /mnt/win/ -o dom=DOMAIN,user=USER,pass=PASS
e.g.
# mount -t cifs //172.16.10.1/private /mnt/win/ -o user=admin,pass=secret

You can use Computer/Server Name instead of IP Address.

  • ‘mount -t cifs’ – mount using the Common Internet File System (CIFS);
  • ‘-o’ – options passed to mount command;
  • ‘user=’ – username;
  • ‘pass=’ – password;
  • ‘dom=’ – domain e.g WORKGROUP (if server in domain).

Mount unprotected (guest) network folder

# mount -t cifs //IP/SAHRE /mnt/win/ -o guest
e.g.
# mount -t cifs //172.16.10.1/public /mnt/win/ -o guest
  • ‘guest’ – don’t prompt for a password.

Mount entire drive

# mount -t cifs //IP/DRIVE$ /mnt/win/ -o dom=DOMAIN,user=USER,pass=PASS
e.g.
# mount -t cifs //172.16.10.1/c$ /mnt/win/ -o user=admin,pass=secret

Unmount share

# umount /mnt/win/

2 Replies to “HowTo: Mount Remote Windows Partition (Share) under Linux”

  1. А если мне надо монтировать скриптом, то как поступить с паролем, он же будет лежать в открытом доступе

  2. Красавелла!!!!
    Столько вариантов попробовал, твой с первого раза победил!
    Рахмет.

Leave a Reply