Trying to use AutoFS to automount samba shares - permission issue following how-to

Linux newbie here. I'm trying to automount a Samba share (my NAS) to a Linux Mint 17.3 VM on my Windows 7 Machine.

I followed this guide on using AutoFS/CIFS.

It involves configuring autoFS (via a config file) to use CIFS to access the Samba share.

When I try to tell autofs to use the new configuration file using the command echo "/cifs /etc/auto.cifs --timeout=60" >>/etc/auto.master

I get a 'permission denied' error - even when prexing the command with sudo.

Any clues as to what I'm doing wrong would be greatly appreciated.

EDIT: Solved (see below)

Posted Jan 20, 2016, 10:55 AM UTC · edited

14
doc_willis•

You need to do that echo command as the root user due to it writing to a non user write able area. You can switch to a root shell in whatever way your district recommends.

Often "sudo -s" is the normal way.

I dont think you can just "sudo echo ....." because the redirection won't have the sudo rights. . I may be wrong. I HATE when directions use somewhat cryptic commands with >> redirections.

What it's really saying is make a file, with these lines in it..

You can do a

sudo nano /path/to/the/file/filename

Then just type in the lines and save the file..

Much safer also. Because you won't miss type a >> redirection.

2
modeskiOP•

Thanks, I ran that command as root. Although the overall aim wasn't working - it wasn't automounting and I couldn't see any errors in /var/syslog, so I did some more reading - including of the coments on that first article, which seem to concur with my opinion that it was all a bit confusing.

Anyway, in the end I got it working another, much simpler way:

  • Created folder to mount to
  • Edited fstab to access the Samba share with the correct credentials
  • Set up a symlink on the deskop

Job done!

Day three of Linux here. Something of a steep learning curve, but really apprecaite the noob-friendliness of this subreddiit. Thanks again.

1
doc_willis•

Some (most?)of the file managers can browse and access samba, shares. I rarely mount them via fstab these days.

There is also a fusesmb command that can allow browsing of shares and accessing them as if they were local directories.

There's always a dozen ways to do anything in Linux it seems. Finding the best way to do what you want is the fun part.

2
modeskiOP•

Yeah, Dolphin was able to browse the share in question (my NAS running Windows Home Server 2011) - and indeed store the user/password - but whenever I tried to stream any media from there into VLC or Dragon Player, it wasn't working. I found that mounting the share meant that streaming worked, hence trying to find a way to automount it - which I've now done!

It does seem like there are many ways to skin a cat, and it's a nice feeling finding the best way as you say. Next project, migrating my email and Firefox bookmarks (although I may manually recreate those, my FF setup is full of 10 years' bloat.)

1