From: Stef Bon <stef@bononline.nl>
To: autofs@linux.kernel.org
Subject: Testing the UID var.
Date: Fri, 28 Mar 2008 10:20:04 +0100 [thread overview]
Message-ID: <47ECB844.8080405@bononline.nl> (raw)
Hello,
the latest weeks I've been testing with the paramters UID, USER etc.
provided by the automounter,
indicating the user activating the mount. I've changed the default
auto.smb script to make use of this var:
(earlier I had another constructing which was not so comprehensive)
---------
#!/bin/bash
key="$1"
opts='-fstype=smbtest,auid=$UID'
SMBCLIENT=/usr/bin/smbclient
[ -x $SMBCLIENT ] || exit 1
# echo $key
$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '
BEGIN { ORS=""; first=1 }
/Disk/ { if (first) { print opts; first=0 }; sub(/ /, "\\ ",
$2); print " \\\n\t /" $2, "://" key "/" $2 }
END { if (!first) print "\n"; else exit 1 }
'
--------
Note:
a. I've made this script I little bit simpler by letting it not search
the smbclient script.
b. the fstype is not smb but smbtest. I've created a wrapper
mount.smbtest which will filter the parameter
auid out. This value can be used for permissions and authentification
c. the extra opion auid (activating user) which will be assigned when
the automounter does the mount, not when running this script. That's why
there are single quotes around it.
Futher I use this wrapper mount.smbtest, which is a little bit too big
to show here. In pseudo code:
---------
#!/bin/sh
# log the parameters, important to see how this script is called
# and what the value of auid is
set | grep "^BASH_ARGV" >> /var/log/mount.smbtest.log
seperate the value auid from the rest of the paramaters
if this auid is not empty, and does exist (an existing user on the system)
check there are credentials for this user
if so then perform a mount.smb with the credentials, with all the right
options (mountpoint, unc_address and other options)
else do a guest mount ( with the right options)
----------
When looking to the logfile, sometimes the auid is correct, but in about
50% of the cases it's empty.
If you would like to test with this I can provide this mount.smbtest script.
Stef Bon
next reply other threads:[~2008-03-28 9:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 9:20 Stef Bon [this message]
2008-03-28 11:50 ` Testing the UID var Stef Bon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47ECB844.8080405@bononline.nl \
--to=stef@bononline.nl \
--cc=autofs@linux.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.