The officially official Devuan Forum!

You are not logged in.

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

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

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: 5  

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

Board footer