The officially official Devuan Forum!

You are not logged in.

#1 2023-01-10 08:28:27

webman
Member
Registered: 2022-08-27
Posts: 22  

How mount samba/cifs share as users home directory at users login?

Hello!

I have setup a devuan (chimaera) system using kvm.
I am planning to have the users home directory residing on a cifs share.
I try to mount is in fstab like this (where ncu9/2009 is the user):

//192.168.26.1/kvmabc-homes--ncu2  /home/ncu9  cifs _netdev,user,mfsymlinks,rw,exec,dev,suid,user_xattr,vers=1.0,username=mbu-smb1,password=123,iocharset=utf8,uid=2009,gid=100,dir_mode=0755,file_mode=0755  0 0

It does not mount on users login.
If I am issuning a "mount -a" as root, it mounts and if the users logs in after this,
everything is ok at a first glance (debating with samba group about missing exec/dev options).

Any tip would be great.
I found hints about a pam.*mount module in the past, but there is nothing on
my devuan-vm and event in the repository.

Manfred

Offline

#2 2023-01-20 22:08:50

ubik
Member
Registered: 2018-05-10
Posts: 6  

Re: How mount samba/cifs share as users home directory at users login?

Install the libpam_mount and libpam-mount-bin packages then edit the primary configuration file:  /etc/security/pam_mount.conf.xml

to add

<volume  
  fstype="cifs"   
  server="192.168.26.1"
  path="%(USER)"
  mountpoint="~/Volumes/servername/" 
  uid="1000-29999"
/>

That's from my config, I make a a share of my server available in my home directory (under Volumes/servername/). You don't need to save your password anywhere (a bad idea!) as PAM does the right thing when you login to the desktop etc. it uses the same username & password for the share and login as for the desktop and works for any normal user. It can also be made to work for remote logins over ssh.

You might need to check if replacing the whole of your home directory works without confusing anything else.

Offline

#3 2023-04-03 05:38:40

webman
Member
Registered: 2022-08-27
Posts: 22  

Re: How mount samba/cifs share as users home directory at users login?

Hi!

Thank you for your investigation and a big sorry for my late reply.
I am having too much trouble at the moment with something like
this.
I've heart about pam-mount, but, due to the fact, that this moment
I stay on debian, I looked there(!), but missed it.
I just (this moment) checked for that package in the VM and it is really there.
But I must delay further, because at the moment, it's not clear if/how
I can use the whole users homedir on a share - there are hints to this,
but they do not work. I asked in the samba groub, but they directed
mit to "cifs" mailinglist and I have first to make that clear and understandable
completely. If this does not become possible, I'll install ZFS in the VM.
The whole thing is about snapshots (the samba share can be snapshotted
on the server).

Regards,
Manfred

Offline

#4 2023-04-04 19:14:02

ubik
Member
Registered: 2018-05-10
Posts: 6  

Re: How mount samba/cifs share as users home directory at users login?

I've not tried mounting the whole of home, the faq in
/usr/share/doc/libpam-mount/faq.txt.gz  says that

Big desktop environments as the aforementioned make use of locking,
symbolic links, and potentially local sockets (UNIX sockets).
If the filesystem and/or the remote server do not support these,
error messages or lockups may ensue.

it also suggests that for KDE you can set it up to use /tmp for its special files.

I'd have to guess you're seeing something like that but I don't know how you'd work around any other problems.

Offline

#5 2023-04-09 11:11:52

webman
Member
Registered: 2022-08-27
Posts: 22  

Re: How mount samba/cifs share as users home directory at users login?

Yes, I stumpled over this on my naive first try and desktop users can even not save all of their,
settings, eben though it "principially" worked.
For samba, there is probably hope via ksmb in the future, I asked them on github. No time now to
ask on cifs mailing-list currently.
For kvm, where the most of my work happens, there is the same for virtiofs(d) and a request is open
to pass a full featured host filesystem - would apply for me too (using zfs).
I need to integrate additional software and will do this using chroot and/or containers.
The best bet for the moment, it looks, is to pass a blockdev to the guest and install zfs in the guest system.
I am on the road to test this and it basicall works. This would allow me to make snapshots and even replicate
them over the network. So I would be, at least, able to have history on a users homedir.
I'll look really to check your example, because it would allow me, to get rid of systemd.
With systemd, if you have configured, say, 10 users, you'll see their mounts, even they are not logged in .....
This is improper state management for users, in my eyes.

Offline

Board footer