[Bug 488229] [NEW] autofs (autofs5) passes wrong environment variables

Stefan Kluth skluth at mppmu.mpg.de
Wed Nov 25 14:27:55 UTC 2009


Public bug reported:

Binary package hint: autofs5

according to man 5 autofs

...
       autofs provides additional variables that are set  based  on  the  user
       requesting the mount:

         USER           The user login name
         UID            The user login ID
         GROUP          The user group name
         GID            The user group ID
         HOME           The user home directory
         HOST           Hostname (uname -n)
...

I expect these env-variables when a fs mount is triggered.  I have the
following executeable map for sshfs

skluth at lapkluth2:~$ cat /etc/auto-script.sshfs 
#!/bin/bash
# This file must be executable to work! chmod 755!
key="${1/%:/}"
user="${key/@*/}"
server="${key/*@/}"
# $GID somehow not set under karmic, so DIY
uid=`id -u ${user}`
gid=`id -g ${user}`
mountopts="-fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536,follow_symlinks,uid=${uid},gid=${gid},UserKnownHostsFile=${HOME}/.ssh/known_hosts,IdentityFile=${HOME}/.ssh/id_rsa"
echo "$mountopts :sshfs\#${user}@${server}\:/mnt/scratch"

echo "auto-script.sshfs: $user $USER $HOME $UID $GID" 1>&2

exit

(credit due to various sources on the net) and I expect the output in
the syslog (daemon.log) to be

auto-script.sshfs: skluth skluth /home/skluth 1000 1000

but I get

Nov 25 10:14:22 lapkluth2 automount[28354]: >> auto-script.sshfs: skluth
root /home/skluth 0

So, $USER is set to root instead of skluth, $UID=0 is root, and $GID is
not set at all.  $HOME is correct probably only by accident, because in
the sudo scheme the root user inherits the $HOME of the user.

This explains various failures I had with sshfs automounting.  I
workaround now by using id with the username inferred from the key
<user>@<server>, but this is a kludge and does not deal with the case
that username is different on client and server.

ProblemType: Bug
Architecture: i386
Date: Wed Nov 25 15:01:51 2009
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: openafs
Package: autofs5 5.0.4-3
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic-pae
SourcePackage: autofs5
Uname: Linux 2.6.31-14-generic-pae i686

** Affects: autofs5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386

-- 
autofs (autofs5) passes wrong environment variables
https://bugs.launchpad.net/bugs/488229
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list