# Can not auto mount a NAS using smb



## shalimar (Jul 12, 2017)

Hello, I have running already an auto mount service. In fact it mounts on access a NAS with NFS, now I have another NAS that uses samba with user and password. So in my /etc/auto_master I have this:  


```
#/media         -media          -nosuid
#/-             -noauto
/- auto_example
```

So in /etc/auto_example I have this


```
/mnt/server    -intr,nfsv3            1.1.1.1:/share
/mnt/server2  -fstype=smbfs      ://@NAS/share
```

And in ~/.nsmbrc


```
[SERVER:USER]
password=passxxx
[SERVER2:USER2]
password=pass2xxx
```

So it works perfect with NFS but it is not working with Samba.

Also it works if I mount it manually like this:


```
mount_smbfs -N -I 2.2.2.2 //@NAS/share/files /mnt/server2
```


When I try to `ls` it shows no files so is not working with auto mount. Can someone help me please.


----------



## SirDice (Jul 12, 2017)

Try using the IP address instead of NAS. The manual command you used connects directly to an IP address (-I 2.2.2.2). The reason it's not automounting may be due to name-resolving issues.


----------



## shalimar (Jul 12, 2017)

SirDice said:


> Try using the IP address instead of NAS. The manual command you used connects directly to an IP address (-I 2.2.2.2). The reason it's not automounting may be due to name-resolving issues.



I changed inside /etc/auto_example to


```
/mnt/server2  -fstype=smbfs      ://2.2.2.2/share
```

Not working also.


----------



## SirDice (Jul 12, 2017)

Is there anything in /var/log/messages? I would expect to see some errors, the exact error may shed some light into the cause. Also check the 'receiving' end; the Samba logs. Look for connections being initiated, or not.


----------



## shalimar (Jul 12, 2017)

SirDice said:


> Is there anything in /var/log/messages? I would expect to see some errors, the exact error may shed some light into the cause. Also check the 'receiving' end; the Samba logs. Look for connections being initiated, or not.



No, I have nothing about this inside the logs which is weird, it is like is doing nothing.


----------



## SirDice (Jul 12, 2017)

Try running the automountd(8) by hand and add the -d option. That should keep it on the foreground and produce some debug output. Then trigger the automount and watch what happens.


----------



## shalimar (Jul 12, 2017)

SirDice said:


> Try running the automountd(8) by hand and add the -d option. That should keep it on the foreground and produce some debug output. Then trigger the automount and watch what happens.



I first stop automountd(8) then did `automountd -d` and in another console I did an `ls` from the folder but nothing, so I tried with the other NAS that use NFS and it worked in the way I got messages from automountd(8)

So, it gives nothing with smbfs, it has to be something wrong.


----------



## bangmyhead (Jun 12, 2018)

shalimar said:


> Hello, I have running already an auto mount service. In fact it mounts on access a NAS with NFS, now I have another NAS that uses samba with user and password. So in my /etc/auto_master I have this:
> 
> 
> ```
> ...




Just for the records, I found the error here trying to do the same and I solved adding the user before the "@"


----------

