[systemd-devel] Mounting cifs per-user

Dan Tihelka dtihelka at gmail.com
Sat Feb 1 14:47:18 PST 2014


Hello all,
I have rather generic idea/question which probably not solvable yet.

I, as an ordinary user, would like to mount cifs share (but it can generally 
be extended to any other "dynamic" media) on-demand to a given path 
(preferably /run/mount/UID/mycifs/).

Currently, mount -t cifs ... must be called as root, although I can specify 
uid=,gid= to set the ownership of the mountpoint. Therefore, the 
mount+automount units must belong to the system instance, not to the user 
instance of systemd. Is it correct?

I am able to create a moutnt mnt-storage_user.mount

	[Unit]
	Wants=network.target
	After=network.target

	[Mount]
	What=//addr/user
	Where=/mnt/storage_user
	Type=cifs


and mnt-shared.automount:

	[Install]
	WantedBy=multi-user.target

configs.


Now, I would like to make the mount unit generic, something like:

	[Mount]
	What=//addr/%u
	Where=/run/mount/%U/storage_%u

however, I am not sure if %* variables are allowed here and of course I do not 
know how to name the unit file (run-mount-%U-storage_%u.mount does not seem 
appropriate). 

Well, even when I replaced all %* variables with the defined names, it still 
refused to mount the directory:

	-- Subject: Unit run-mount-1000-storage_dtihelka.mount has failed
	-- Defined-By: systemd
	-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
	-- Documentation: 												
http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
-- 
	-- Unit run-mount-1000-storage_dtihelka.mount has failed.

BTW, the link was invalid ...



Did I miss something?


----

On the more hypothetical note, my vision of working with pluggable or network 
storage media was the following:

* in my DM (KDE, Gnome, ...) I can define (somehow, not important here) that I 
want a FOO share mounted to BAR directory (with the guarantee that no other 
user will be able to read the data there).

* this requirement will be passed to a "mounting manager", either it is 
systemd itself or any other daemon.

* when I access the BAR mountpoint, I will be asked to the password (if 
required) and FOO will be mounted. The password could, of course, be managed 
by a passwd manager (e..g. kwallet in KDE).


Seems to be easy, but surely it is not that easy to implemented since it 
expects the cooperation of many components. But I would like to ask, if 
systemd infrastructure allows something like this to be hooked into or if this 
would have to be solved by an independent (system-level?) daemon (maybe 
feeding systemd with the mount requests).

Hope I haven got it totally wrong. Please correct me if O have overlooked 
something ...

Thank you very much,
best regards

Dan t.






-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140201/60786885/attachment.pgp>


More information about the systemd-devel mailing list