first commit

This commit is contained in:
root
2023-10-14 17:36:14 +02:00
parent 60750bc0d7
commit e1d7932ddc
166 changed files with 44276 additions and 0 deletions

44
autofs/etc/auto.master Normal file
View File

@@ -0,0 +1,44 @@
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
#/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
#/net -hosts
#
# Include /etc/auto.master.d/*.autofs
# To add an extra map using this mechanism you will need to add
# two configuration items - one /etc/auto.master.d/extra.autofs file
# (using the same line format as the auto.master file)
# and a separate mount map (e.g. /etc/auto.extra or an auto.extra NIS map)
# that is referred to by the extra.autofs file.
#
+dir:/etc/auto.master.d
#
# If you have fedfs set up and the related binaries, either
# built as part of autofs or installed from another package,
# uncomment this line to use the fedfs program map to access
# your fedfs mounts.
#/nfs4 /usr/sbin/fedfs-map-nfs4 nobind
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
#
#
/mnt/vchanger /etc/auto.vchanger --timeout=30
/mnt/cifs /etc/auto.smb --timeout=120
#
#eof

54
autofs/etc/auto.net Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# This file must be executable to work! chmod 755!
# Look at what a host is exporting to determine what we can mount.
# This is very simple, but it appears to work surprisingly well
key="$1"
# add "nosymlink" here if you want to suppress symlinking local filesystems
# add "nonstrict" to make it OK for some filesystems to not mount
# choose one of the two lines below depending on the NFS version in your
# environment
[ -f /etc/default/autofs ] && . /etc/default/autofs
if [ -z "$MOUNT_NFS_DEFAULT_PROTOCOL" -o "$MOUNT_NFS_DEFAULT_PROTOCOL" == "3" ]; then
# Showmount comes in a number of names and varieties. "showmount" is
# typically an older version which accepts the '--no-headers' flag
# but ignores it. "kshowmount" is the newer version installed with knfsd,
# which both accepts and acts on the '--no-headers' flag.
#SHOWMOUNT="kshowmount --no-headers -e $key"
#SHOWMOUNT="showmount -e $key | tail -n +2"
for P in /bin /sbin /usr/bin /usr/sbin
do
for M in showmount kshowmount
do
if [ -x $P/$M ]
then
SMNT=$P/$M
break
fi
done
done
[ -x $SMNT ] || exit 1
# Newer distributions get this right
SHOWMOUNT="$SMNT --no-headers -e $key"
$SHOWMOUNT | LC_ALL=C cut -d' ' -f1 | LC_ALL=C sort -u | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
END { if (!first) print "\n"; else exit 1 }
' | sed 's/#/\\#/g'
opts="-fstype=nfs,hard,intr,nodev,nosuid"
else
# NFSv4
opts="-fstype=nfs4,hard,intr,nodev,nosuid,async"
echo "$opts $key:/"
fi

82
autofs/etc/auto.smb Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/bash
# This file must be executable to work! chmod 755!
# Automagically mount CIFS shares in the network, similar to
# what autofs -hosts does for NFS.
# Put a line like the following in /etc/auto.master:
# /cifs /etc/auto.smb --timeout=300
# You'll be able to access Windows and Samba shares in your network
# under /cifs/host.domain/share
# "smbclient -L" is used to obtain a list of shares from the given host.
# In some environments, this requires valid credentials.
# This script knows 2 methods to obtain credentials:
# 1) if a credentials file (see mount.cifs(8)) is present
# under /etc/creds/$key, use it.
# 2) Otherwise, try to find a usable kerberos credentials cache
# for the uid of the user that was first to trigger the mount
# and use that.
# If both methods fail, the script will try to obtain the list
# of shares anonymously.
get_krb5_cache() {
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
return
fi
done
if [ -f /tmp/krb5cc_$uid ] && klist -s /tmp/krb5cc_$uid; then
cache=/tmp/krb5cc_$uid
return
fi
}
key="$1"
opts="-fstype=cifs"
for P in /bin /sbin /usr/bin /usr/sbin
do
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"
smbopts="-A $creds"
else
get_krb5_cache
if [ -n "$cache" ]; then
opts="$opts"',multiuser,cruid=$UID,sec=krb5i'
smbopts="-k"
export KRB5CCNAME=$cache
else
opts="$opts"',guest'
smbopts="-N"
fi
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 }
'

3
autofs/etc/auto.vchanger Normal file
View File

@@ -0,0 +1,3 @@
# /etc/auto.vchanger
* -fstype=auto,rw,sync :/dev/disk/by-uuid/&
# eof

View File

@@ -0,0 +1,3 @@
username=user
password=secretWord
domain=workgroup