autofs/etc/auto.smb aktualisiert
This commit is contained in:
parent
3445086dc5
commit
48a75ea45f
@ -27,38 +27,39 @@ get_krb5_cache() {
|
||||
uid=${UID}
|
||||
for x in $(ls -d /run/user/$uid/krb5cc_* 2>/dev/null); do
|
||||
if [ -d "$x" ] && klist -s DIR:"$x"; then
|
||||
cache=DIR:$x
|
||||
cache=DIR:$x
|
||||
return
|
||||
fi
|
||||
done
|
||||
if [ -f /tmp/krb5cc_$uid ] && klist -s /tmp/krb5cc_$uid; then
|
||||
cache=/tmp/krb5cc_$uid
|
||||
return
|
||||
cache=/tmp/krb5cc_$uid
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
key="$1"
|
||||
opts="-fstype=cifs"
|
||||
opts="-fstype=cifs,file_mode=0777,dir_mode=0777,nounix,gid=tape,uid=bacula,forcegid,forceuid"
|
||||
|
||||
for P in /bin /sbin /usr/bin /usr/sbin
|
||||
do
|
||||
if [ -x $P/smbclient ]
|
||||
then
|
||||
SMBCLIENT=$P/smbclient
|
||||
break
|
||||
fi
|
||||
if [ -x $P/smbclient ]
|
||||
then
|
||||
SMBCLIENT=$P/smbclient
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -x $SMBCLIENT ] || exit 1
|
||||
|
||||
|
||||
creds=/etc/creds/$key
|
||||
if [ -f "$creds" ]; then
|
||||
opts="$opts"',uid=$UID,gid=$GID,credentials='"$creds"
|
||||
opts="$opts"',credentials='"$creds"
|
||||
smbopts="-A $creds"
|
||||
else
|
||||
get_krb5_cache
|
||||
if [ -n "$cache" ]; then
|
||||
opts="$opts"',multiuser,cruid=$UID,sec=krb5i'
|
||||
opts="$opts"',multiuser,cruid=$uid,sec=krb5i'
|
||||
smbopts="-k"
|
||||
export KRB5CCNAME=$cache
|
||||
else
|
||||
@ -68,15 +69,15 @@ else
|
||||
fi
|
||||
|
||||
$SMBCLIENT $smbopts -gL "$key" 2>/dev/null| awk -v "key=$key" -v "opts=$opts" -F '|' -- '
|
||||
BEGIN { ORS=""; first=1 }
|
||||
/Disk/ {
|
||||
if (first)
|
||||
print opts; first=0
|
||||
dir = $2
|
||||
loc = $2
|
||||
# Enclose mount dir and location in quotes
|
||||
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
|
||||
}
|
||||
END { if (!first) print "\n"; else exit 1 }
|
||||
'
|
||||
BEGIN { ORS=""; first=1 }
|
||||
/Disk/ {
|
||||
if (first)
|
||||
print opts; first=0
|
||||
dir = $2
|
||||
loc = $2
|
||||
# Enclose mount dir and location in quotes
|
||||
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
|
||||
}
|
||||
END { if (!first) print "\n"; else exit 1 }
|
||||
'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user