Permission issues mounting SMB share

Foremost, thank you everyone for being so incredibly helpful.

I have been struggling to mount some SMB shares in my home directory.

  • I am able to manually navigate to the smb://IP/Share and authenticate and have proper permissions and everything works fine.
  • I am able to mount the locations with my fstab, but I only have read permissions.
#//IP/SHARE/ /home/USERNAME/Documents/media cifs _netdev,credentials=/etc/cifsauth 0 0
  • I have tried automounting using the mount.
  • I made sure to create the mount and auto mount file, but that was not working at all. I ensure they were named correctly as well. PATH.mount and PATH.automount

Mount

[Unit]
Description=unraid SMB meda share

[Mount]
What=//IP/SHARE/
Where=/home/USERNAME/Documents/media
Type=cifs
Options=_netdev,iocharset=utf8,rw,file_mode=0777,dir_mode=0777,credentials=/etc/cifsauth,vers=2
TimeoutSec=30

[Install]
WantedBy=multi-user.target

Automount

[Unit]
Description=Automount unraid SMB meda share
After=network-online.target
Wants=network-online.target

[Automount]
Where=/home/USERNAME/Documents/media
TimeoutIdleSec=10

[Install]
WantedBy=multi-user.target
  • I have installed smb4k and was attempting to mount using that. I can see the server, but it will not show me the shares to mount using smb4k so I must be doing something wrong as far as that goes.

Any insight would be incredibly helpful, thank you so much! Please let me know if there are any other configs or detials I could or should share!

Hi @infiniteape, and welcome!

I suggest you look here, [root tip] Use systemd to mount ANY device and here, [root tip] systemd mount unit samples.

I have used an automount personally and it works like a charm. I’m guessing the SMB ones will too.

Hope this helps!

Mounting inside your home folder creates issues with permissions because the mount happens before you login.

Mount outside your /home/USER - e.g. /data/media - and symlink into your home instead. Remember to rename you unit files to match the new location.

Another possible option is use gio to mount the share when you login as user. Using this option doesn’t require systemwide configuration.

Thank you for the details.

I updated my fstab to mount it in my /data/ directory. I am still having the same issue.

I have read access but not write.

I tried 3 different configurations, all with the same result.

//servername.local/Datastore/ /data/datastore cifs _netdev,credentials=/etc/cifsauth 0 0
//192.168.1.5/Downloads/ /data/Downloads cifs credentials=/etc/cifsauth,noauto,x-systemd.automount,x-systemd.device-timeout=10,rw
//192.168.1.5/Media/ /data/Media cifs credentials=/etc/cifsauth,noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,file_mode=0755,dir_mode=0755

I am going to try the mount units again, but I was trying with smb4k and not having any luck either.

I was finally able to get this solved by adding UID and GID! I feel like I have done that before, and it did not work!

//192.168.10.2/Downloads/ /data/Downloads cifs _netdev,credentials=/etc/cifsauth,uid=1000,gid=1000,x-systemd.automount,x-systemd.device-timeout=10 0 0

Now that I have played with it a bit, I think I am having I/O errors outlined in this warning.

Warning: Using uid and/or gid as mount options may cause I/O errors, it is recommended to set/check correct File permissions and attributes instead.

I am going to explore this a bit, but any guidance is appreciated!

Did you remember to change permissions on the folder structure before starting the units?

sudo chmod -R ugo+rw /data

Please realize that setting uid and gid is affecting only the mount point (client side) .

The same goes for file_mode=0777 and dir_mode=0777 which can be used to override the default on shares located on Windows servers and give access to everyone.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.