HowTo: Auto Mounting Samba Shares Using AutoFS

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
freen
Level 1
Level 1
Posts: 25
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby freen » Sun Sep 07, 2014 3:05 pm

Hi,
I've followed this HowTo and everything was working fine. However, recently I no longer have write permissions to my autofs mounted samba shares.
I can write to them if I navigate via the network, so I don't think it's the NAS, but the autofs folders are read only.
Can anyone help?

altair4
Level 18
Level 18
Posts: 8769
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby altair4 » Sun Sep 07, 2014 3:14 pm

Unless you changed your mount instructions I don't know of any changes to autofs itself.

Would you post the map file please:

Code: Select all

cat /etc/auto.sambashares

And what desktop environment are you using. The reason I ask is that there is a known issue with thunar in XFCE and AutoFS.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

freen
Level 1
Level 1
Posts: 25
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby freen » Tue Sep 09, 2014 11:13 am

Here you go:

Code: Select all

Music.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,iocharset=utf8 ://freencloud.local/music
Movies.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,iocharset=utf8 ://freencloud.local/movies
Backup.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,iocharset=utf8 ://freencloud.local/freenbackup
Pictures.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,iocharset=utf8 ://freencloud.local/pictures


...and I'm using cinnamon

altair4
Level 18
Level 18
Posts: 8769
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby altair4 » Tue Sep 09, 2014 12:21 pm

Change the first line from this:
Music.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,iocharset=utf8 ://freencloud.local/music

To this:
Music.freencloud -fstype=cifs,rw,credentials=/home/freen/.smbcredentials,uid=freen,iocharset=utf8 ://freencloud.local/music

Then restart autofs:

Code: Select all

sudo service autofs restart

And see if that fixes it for that particular mount.

If it does then add the uid option to all your mount expressions.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

freen
Level 1
Level 1
Posts: 25
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby freen » Thu Sep 11, 2014 4:49 am

Hi altair4.
Thanks for that. It worked!

tomsey
Level 1
Level 1
Posts: 7
Joined: Mon Nov 10, 2014 3:39 pm

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby tomsey » Sat Dec 27, 2014 12:06 pm

I'm having some problems with autofs when logging in.
My NAS spins down the disks when they aren't used.

When logging into my user in Mint the desktop only will load when the mounts are connected, which takes about 15 seconds because the NAS needs the spin up the disks.
Normally the login takes like 2 seconds.

Can I fix this in some way?

altair4
Level 18
Level 18
Posts: 8769
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby altair4 » Sat Dec 27, 2014 12:58 pm

tomsey wrote:I'm having some problems with autofs when logging in.
My NAS spins down the disks when they aren't used.

When logging into my user in Mint the desktop only will load when the mounts are connected, which takes about 15 seconds because the NAS needs the spin up the disks.
Normally the login takes like 2 seconds.

Can I fix this in some way?

I have never had to deal with that use case so I'm not sure how to resolve that issue. I don't think that you can fix that through AutoFS itself or even though Linux itself but I'm just not sure.

Does the NAS device itself have a control for that?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Nomin
Level 2
Level 2
Posts: 87
Joined: Sat Dec 21, 2013 7:21 pm

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby Nomin » Fri Feb 20, 2015 6:30 am

Thank you for this clear guide, worked well with unRAID shares!

The only minor issue I found is that though mount -command from CLI doesn't require a password, the shares would auto mount only after I added the password to the auto.sambashares file - with a blank (space) password they didn't mount.

sleepyhead
Level 1
Level 1
Posts: 1
Joined: Fri Sep 11, 2015 11:05 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby sleepyhead » Fri Sep 11, 2015 11:19 am

Thanks for this tutorial, it works great on Linux Mint 17.2 for syncing a KeePass database from an OpenWRT SMB share.

User avatar
blockhead47
Level 2
Level 2
Posts: 58
Joined: Wed Jun 15, 2016 4:50 pm

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Postby blockhead47 » Sat Oct 14, 2017 10:38 pm

I know this is an old post but it is still relevant, very informative and exactly what I needed to know.
Yes I did google for this information but did not find the concise explanation here.

Thanks again altair4.

EDIT: As I maintain multiple systems this solution is better for me than viewtopic.php?f=42&t=144997.
I feel safer modifying the /etc/auto.[your_name_here] files than the /etc/fstab files. If I do something stupid in the fstab the system may not boot. :D


Return to “Tutorials”