Ask Your Question
1

Mount system.d rights cifs

asked 2018-11-16 12:23:16 -0500

fordprefect gravatar image

Hi, I have a NAS in my network which is setup with samba. I got some hint here that I should mount it with system.d instead of fstab. In principle it works, but I have one problem. When I enter the share with Nautilus, I can't create a folder for example. If I do it with mkdir it is possible but with Nautilus the option is greyed out. When I go one level deeper I can create folders again. I think this is linked to the following observation.

If I do ls -l /mnt I see that the folders belong to root. When I enter it with Natutilus and do something there and run the same command again, the owner is changed to my user.

Here is an example of a mount file named mnt-Temps.mount

[Unit]

Description=cifs mount script
Requires=network-online.target
After=network-online.service

[Mount]
What=//192.168.178.100/Temps
Where=/mnt/Temps
Type=cifs
Options=credentials=/home/user/.smbc,vers=3.0,uid=1000,gid=1000

[Install]
WantedBy=multi-user.target

And here is the mnt-Temps.automount

[Unit]
Description=cifs mount script
Requires=network-online.target
After=network-online.service

[Automount]
Where=/mnt/Temps
TimeoutIdleSec=10

[Install]
WantedBy=multi-user.target

Do I have to change the owner in /mnt before I mount the files to the user? Or what I am missing?

I am also not super sure, whether the Timeout could cause some problems in case it doesn't detect usage.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-11-19 04:55:14 -0500

fordprefect gravatar image

I think I sorted it out. So it's not necessary to mess around with the owner and mode of the mountpoint directory. It's overwritten anyway by the automount on reboot.

When accessed the owner of the mount point is set correctly to the owner of the mounted share.

But Nautilus just doesn't recognize the change of the ownership in the root file system. One can simply click ctrl+r to reload it. Than Nautilus refreshes the information and tada I can create folders and files in /mnt/share.

However it would be really nice if one could automize it so that if the automount gets active nautilus is refreshed. For the moment I think the problem is solved. At least it's not a problem of the mounting.

edit flag offensive delete link more
0

answered 2018-11-17 03:20:56 -0500

fordprefect gravatar image

Ok, I tried out something and apparently it seems to work. Maybe someone can give me a comment whether this is the best way, because I want to learn.

I changed the mode and the owner of the mountpoints by

$sudo chmod 777 /mnt/*

and

$sudo chown -c username:username /mnt/*

Now I can create folders directly with Nautilus in /mnt/Mountpoint/.

edit flag offensive delete link more

Comments

Okay this didn't worked as expected. As soon as I reboot, the mode and owner of the mountpoints is reset to root:root. And again when I mount I cannot do anything on the level /mnt/mountpoint. That sucks.

I think this is maybe the wrong attempt. If I open the mount point the automount correctly mounts the share and I can see by ls -l /mnt/ that the owner is switched correctly to my user. However Nautilus does not recognize it. When I go to settings it still says the folder belongs to root. When I do some stuff e.g. create a folder there with mkdir Nautilus recognizes the owner correctly.

fordprefect gravatar imagefordprefect ( 2018-11-19 02:26:40 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-16 12:23:16 -0500

Seen: 223 times

Last updated: Nov 19 '18