2

Trying to set up roaming profile for user by mounting remote samba share using pam_mount. However, nounix option is being automatically added on the mounted folder due to which symlinks cannot be created on the shared folder nor can the csync program be used for syncing.

Relevant files and outputs:

$ cat /etc/security/pam_mount.conf.xml

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<!--
    See pam_mount.conf(5) for a description.
-->

<pam_mount>

        <!-- debug should come before everything else,
        since this file is still processed in a single pass
        from top-to-bottom -->

<debug enable="1" />

        <!-- Volume definitions -->


        <!-- pam_mount parameters: General tunables -->

<!--
<luserconf name=".pam_mount.conf.xml" />
-->

<!-- Note that commenting out mntoptions will give you the defaults.
     You will need to explicitly initialize it with the empty string
     to reset the defaults to nothing. -->
<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
<!--
<mntoptions deny="suid,dev" />
<mntoptions allow="*" />
<mntoptions deny="*" />
-->
<mntoptions require="nosuid,nodev" />

<logout wait="0" hup="0" term="0" kill="0" />


        <!-- pam_mount parameters: Volume-related -->
<!-- LINE BELOW WAS ADDED! -->
<volume fstype="cifs" server="server.lan" path="%(DOMAIN_USER)" mountpoint="/home/roaming/%(DOMAIN_NAME)/%(DOMAIN_USER)" options="vers=2.1,uid=%(USER)" />

<mkmountpoint enable="1" remove="true" />


</pam_mount>

$ mount

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1935432k,nr_inodes=483858,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=391560k,mode=755)
/dev/sda1 on / type ext4 (rw,noatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3286)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1274545246 type tmpfs (rw,nosuid,nodev,relatime,size=391560k,mode=700,uid=1274545246,gid=1274544641)
//server.lan/aaditya on /home/roaming/SERVER/aaditya type cifs (rw,relatime,vers=2.1,sec=ntlmssp,cache=strict,username=aaditya,domain=SERVER,uid=1274545246,forceuid,gid=1274544641,forcegid,addr=192.168.1.191,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1)
gvfsd-fuse on /run/user/1274545246/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1274545246,group_id=1274544641)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=391560k,mode=700,uid=1001,gid=1001)
gvfsd-fuse on /run/user/1001/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001)

mount.cifs(8) has the following info:

       nounix
       Disable the CIFS Unix Extensions for this mount. This can be useful in order to turn off multiple settings at once. This includes POSIX acls, POSIX locks,
       POSIX paths, symlink support and retrieving uids/gids/mode from the server. This can also be useful to work around a bug in a server that supports Unix
       Extensions.

       See section INODE NUMBERS for more information.

I tried adding unix to the list of mount options but that fails with:

mount error(22): Invalid argument Nov 3 17:24:35 system lightdm: (mount.c:76): Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Why is the nounix option being automatically added how can it be disabled?

Alternatively can I know which are the exact options disabled by nounix so that they can be enabled?

OS is Ubuntu 16.04

$ uname -srm
Linux 4.10.0-38-lowlatency x86_64

With the folder already mounted by pam_mount, if I unmount and then remount it gets the same mount output.

However, if I disable folder mount in pam_mount, logout, login and try to mount it manually via the command line, then in some cases I do not get nounix in the mount options? (quite confusing; need to pinpoint where it works and where it doesn't)

1

After much hit and try, this seems to be an effect of the vers option. If vers=2.1 is removed, unix extensions seem to get enabled:

//server.lan/aaditya on /home/roaming/SERVER/aaditya type cifs (rw,relatime,vers=1.0,cache=strict,username=aaditya,domain=SERVER,uid=1274545246,forceuid,gid=1274544641,forcegid,addr=192.168.1.191,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1)

The reason I had added vers=2.1 is because the samba share has a disk space quota, but with 1.0 the free space of whole disk is shown rather than that of the quota.

So the question now is: how to enable unix extensions for ver 2.1 of samba?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.