HowTo: Auto Mounting Samba Shares Using AutoFS

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
freen
Level 1
Level 1
Posts: 29
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by freen »

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 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by altair4 »

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: 29
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by freen »

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 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by altair4 »

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: 29
Joined: Fri Aug 23, 2013 5:42 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by freen »

Hi altair4.
Thanks for that. It worked!
tomsey

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by tomsey »

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 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by altair4 »

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 3
Level 3
Posts: 160
Joined: Sat Dec 21, 2013 7:21 pm

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by Nomin »

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

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by sleepyhead »

Thanks for this tutorial, it works great on Linux Mint 17.2 for syncing a KeePass database from an OpenWRT SMB share.
blockhead47
Level 3
Level 3
Posts: 140
Joined: Wed Jun 15, 2016 4:50 pm

Re: HowTo: Auto Mounting Samba Shares Using AutoFS

Post by blockhead47 »

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
Post Reply

Return to “Tutorials”