Žilinská univerzita > Fakulta riadenia a informatiky > Katedra informačných sietí

Linux Mint - how to share/mount remote windows folder in network with domain controller

Here I will briefy describe how to mount a remote windows folder to a local mint linux machine. In general, on the web there are plenty of pages how to do that. However I will focus on situation where windows is using an active direstory or domain based authentication.

 

First of all install cifs-utils package

apt-get install cifs-utils

or just check if it is not already installed

sudo dpkg -l cifs-utils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version               Architecture          Description
+++-=================================-=====================-=====================-========================================================================
ii  cifs-utils                        2:6.0-1ubuntu2        amd64                 Common Internet File System utilities

then make some local folder where we will mount remote folder

mkdir ~/share/PC-D

then we will share a remote folder typing following command

sudo mount -t cifs //REMOTE-WIN-NAME-OR-IP/REMOTE-SHARED-FOLdER /LOCAL-LINUX-SHARE -o user=WIN-USERNAME,domain=WIN-DOMAIN

where in my case it should be

sudo mount -t cifs //192.168.10.108/D /home/palo/share/PC-D/ -o user=palo,domain=kis

NOTE: The domain keywors is here important

then you will be prompted for password

Password for palo@//192.168.10.108/D:

so type it and that all is done.

Alternatively you may specify the password within the mount command

do mount -t cifs //REMOTE-WIN-NAME-OR-IP/REMOTE-SHARED-FOLdER /LOCAL-LINUX-SHARE -o user=WIN-USERNAME,domain=WIN-DOAMIN,password=WIN-PASS

 

Verify it typing mount

palo@PS $ mount
...
//192.168.10.108/D on /home/palo/share/PC-D type cifs (rw)

 

Unmounting

just type

sudo umount /LOCAL-MOUNT-FOLDER

In my case

sudo umount /home/palo/share/PC-D

 

 

How to make the mounting permanent?

Open /etc/fstab d

sudo vim /etc/fstab

and add line

//REMOTE-WIN-NAME-OR-IP/REMOTE-SHARED-FOLdER /LOCAL-LINUX-SHARE user=WIN-USERNAME,domain=WIN-DOAMIN,password=WIN-PASS,iocharset=utf8 0 0

in my case

//192.168.10.108/D /home/palo/share/PC-D/ cifs  user=palo,domain=kis,password=********,iocharset=utf8 0 0

then remount it all

sudo mount -a

and check with

mount

 

More secure way of the same

Previous example has a problem that the /etc/fstab may read someone and see your passwords, therefore a secure way of the same is to make a local text file

vim ~.credentials

and put there

username=valuevalue
password=valuevalue
domain=valuevalue

whare "value" are yours usernanme/password/domain_name

then modify /etc/fstab line from

//REMOTE-WIN-NAME-OR-IP/REMOTE-SHARED-FOLdER /LOCAL-LINUX-SHARE user=WIN-USERNAME,domain=WIN-DOAMIN,password=WIN-PASS,iocharset=utf8 0 0

to

//REMOTE-WIN-NAME-OR-IP/REMOTE-SHARED-FOLdER /LOCAL-LINUX-SHARE credentials=/PATH-to-CRED-FILE/FILENAME,iocharset=utf8 0 0

then close the file and run

sudo mount -a

Done!

Troubleshooting

You may receive after typing mount -a command err message

palo@PS ~ $ sudo mount -a
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

then check your name, password and domain name if are types correctly.

Resources:

Skupiny: