0

I have a samba shares drive that is mounted at boot that works as I intend. Here is the fstab file:

//192.168.1.2/ext4tb /mnt/ext4tb cifs ,credentials=/home/frepie/.smbcredentials,iocharset=utf8,vers=1.0,sec=ntlm,user  0  0 

When this works normally, I have total read,write and execute privileges on that share

Sometimes, for reasons that I ignore, that shared drive is not mounted at boot. Trying to resolve the issue without rebooting, I used the command

sudo mount.cifs //192.168.1.2/ext4tb /mnt/ext4tb

And the command requests the root password on the samba server

Password for root@//192.168.1.2/ext4tb:  ********

The problem is the when doing so, I don't have the write privileges that I have when the mount at boot works normally.

$ mv /home/frepie/Music/Dark\ Latin\ Groove\ -\ La\ Quiero\ A\ Morir /mnt/ext4tb/media/Audio/
mv: cannot create regular file '/mnt/ext4tb/media/Audio/Dark Latin Groove - La Quiero A Morir': Permission denied

Somehow, I am not granted the same privileges when the mount is performed by fstab at boot.

4
  • IIRC mount only consults the fstab file if either the device OR mountpoint is given: does it work if you simply do sudo mount /mnt/ext4tb for example? Jun 1, 2018 at 16:46
  • Seems you put your finger on something: When I do as you suggested (sudo mount /mnt/ext4tb), it works iéeé the drive is mounted as with fstab. When I do sudo mount.cifs //192.168.1.2/ext4tb /mnt/ext4tb, the drive is mounted but without writing privileges....Can you point me to a proper page that would explain this behavior?
    – frepie
    Jun 1, 2018 at 17:15
  • How about a simple sudo mount -a ? That uses fstab. Jun 1, 2018 at 20:14
  • I get an error when I do that: "mount error(5): Input/output error"
    – frepie
    Jun 11, 2018 at 21:02

3 Answers 3

1

As far as I know, the behavior that you're looking for (i.e. consulting the /etc/fstab file, and applying the options found there) only applies if you call mount directly, rather than one of the "helper" commands like mount.cifs, and only if you specify EITHER the device or the mountpoint. From man mount:

   If only the directory or the device is given, for example:

          mount /dir

   then  mount looks for a mountpoint (and if not found then for a device)
   in the /etc/fstab file.  It's possible to use the --target or  --source
   options  to avoid ambivalent interpretation of the given argument.  For
   example:

          mount --target /mountpoint

So replace

sudo mount.cifs //192.168.1.2/ext4tb /mnt/ext4tb

by either

sudo mount /mnt/ext4tb

or

sudo mount //192.168.1.2/ext4tb
0

Hi i do exactly the same : smb shares declared in /etc/fstab except that is do not automount, and i stored credential files in encrypted folders. I do not experience no issue.

Here is an extract of /etc/fstab on 18.04

//192.168.1.100/video  /media/user/Video  cifs  noauto,user,_netdev,sec=ntlm,credentials=/home/user/Crypt/credentials,uid=1000,gid=1000,vers=1.0  0 0

See uid=1000,gid=1000

You may add thoses option : explicitly specify grouid an userid of your Ubuntu user

With the noauto option i like, shares are mounted when I click to open them from nautilus file manager.

Using _netdev option means that this mount needs a network

4
  • The problem I have is not with the fstab file, it is when I try to mount it manually. Somehow, permissions are not the same as when mounted with fstab at boot.
    – frepie
    Jun 1, 2018 at 17:06
  • why need you to mount manually
    – cmak.fr
    Jun 1, 2018 at 17:25
  • Because sometimes, for a reason unknown, the automount at boot is not applied.
    – frepie
    Jun 1, 2018 at 19:21
  • give a try to the fstab options i suggest (noauto, _netdev, gid, uid) and let us know if it goes better ... you may then get the manual mount with simple mount /to/destination
    – cmak.fr
    Jun 2, 2018 at 16:25
0

Seems the answer is to simply mount the drive without cifs i.e.

sudo mount /mnt/ext4tb

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .