ubuntu – 使用pam_mount进行多次登录意味着多个(冗余)安装

前端之家收集整理的这篇文章主要介绍了ubuntu – 使用pam_mount进行多次登录意味着多个(冗余)安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经将pam_mount.so配置为在用户登录自动挂载cifs共享;问题是如果用户同时登录多次,mount命令会重复多次.

到目前为止这不是一个问题,但是当你查看mount命令的输出时它很麻烦.

# mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nodev)
none on /var/run type tmpfs (rw,mode=0755)
none on /var/lock type tmpfs (rw,nodev)
none on /lib/init/rw type tmpfs (rw,mode=0755)
//srv1/UserShares/jrisk on /home/jrisk type cifs (rw,mand)
//srv1/UserShares/jrisk on /home/jrisk type cifs (rw,mand)

我假设我需要使用pam.d / common-auth文件或pam_mount.conf.xml来完成此操作.

如何指示pam_mount.so以避免重复安装?

[编辑]

我的pam_mount.conf.xml文件内容

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
  <debug enable="1" />
  <volume user="*" server="srv1" path="UserShares" mountpoint="home" fstype="cifs" />
  <cifsmount>mount -t cifs //%(SERVER)/%(VOLUME)/%(USER) %(MNTPT)/%(USER) -o "user=%(USER),uid=%(USERUID),gid=%(USERGID)%(before=\",\" OPTIONS)"</cifsmount>
  <umount>umount %(MNTPT)/%(USER)</umount>
  <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
  <mntoptions require="nosuid,nodev" />
  <path>/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin</path>
  <logout wait="0" hup="0" term="0" kill="0" />
  <mkmountpoint enable="1" remove="true" />
</pam_mount>
为什么不使用 autofs

猜你在找的Ubuntu相关文章