2

As long as I had only one mount everything was fine.

file: /etc/auto.master
/mnt /etc/auto.srv1_share1
file: /etc/auto.srv1_share1
sh1 -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share1

which resulted in //srv1/share1 mounted to /mnt/sh1.

But so far I've been unable to mount multiple shares. The result should be something like that:
//srv1/share1 to /mnt/srv1_share1
//srv1/share2 to /mnt/srv1_share2
or
//srv1/share1 to /mnt/srv1/share1
//srv1/share2 to /mnt/srv1/share2

After trying, googling and reading(tfm) for hours, I need your help.

My current solution/workaround is this:

file: /etc/auto.master
/mnt/srv1_share1 /etc/auto.srv1_share1
/mnt/srv1_share2 /etc/auto.srv1_share2
file: /etc/auto.srv1_share1
share -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share1
file: /etc/auto.srv1_share2
share -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share2

resulting in these mounts:
//srv1/share1 to /mnt/srv1_share1/share
//srv1/share2 to /mnt/srv1_share2/share

Altough I can access all files I still want to get rid of those extra share-directories.

How can I accomplish this?

2 Answers 2

3

You can get the informations from this link: Ubuntu community, Autofs, 3.1.1. Direct and Indirect Maps "Direct maps create a mount-point at the path specified in the relevant map file. The mount-point entry in auto.master is always /-"

Let's create our mount-points, and add lines to /etc/auto.master

/-        /etc/auto.srv1_share1
/-        /etc/auto.srv1_share2

Created mount-points will be specified at the place in auto.srv1_share1 and auto.srv1_share2 files. Edit your files and add full /path/to/folder and it will work.

For example, /etc/auto.srv1_share1 should look like this line:

/path/to/share -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share1
1

Does this work?

file: /etc/auto.master /mnt /etc/auto.srv1 file: /etc/auto.srv1 srv1_share1 -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share1 srv1_share2 -fstype=cifs,rw,user=jdoe,domain=srv1,noexec,password=xxx ://srv1/share2

2
  • Altough AutoFS creates the subdirectories I can't access them: root@srv1:/mnt# ll total 4 drwxr-xr-x 4 root root 0 May 12 17:09 ./ drwxr-xr-x 24 root root 4096 May 6 06:42 ../ dr-xr-xr-x 2 root root 0 May 12 17:09 share1/ dr-xr-xr-x 2 root root 0 May 12 17:09 share2/ root@srv1:/mnt# cd share1 -bash: cd: share1: No such file or directory root@srv1:/mnt# ls share1 ls: cannot open directory share1: No such file or directory cannot open directory share1: No such file or directory
    – tiMbeRdroP
    May 12, 2015 at 15:12
  • Looks like some leftover cruft... it should have created /mnt/srv1_share1 and /mnt/srv1_share2 -- not /mnt/share[1,2] May 21, 2015 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.