add allow access wide symbolic links option (#66)
* add allow access wide symbolic links option * Update README.md * Update samba.sh
This commit is contained in:
parent
c72d17eee3
commit
ec73b63ac7
@ -60,6 +60,7 @@ OR set local storage:
|
|||||||
-w "<workgroup>" Configure the workgroup (domain) samba should use
|
-w "<workgroup>" Configure the workgroup (domain) samba should use
|
||||||
required arg: "<workgroup>"
|
required arg: "<workgroup>"
|
||||||
<workgroup> for samba
|
<workgroup> for samba
|
||||||
|
-W Allow access wide symbolic links
|
||||||
|
|
||||||
The 'command' (if provided and valid) will be run instead of samba
|
The 'command' (if provided and valid) will be run instead of samba
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ ENVIRONMENT VARIABLES (only available with `docker run`)
|
|||||||
* `NMBD` - As above, enable nmbd
|
* `NMBD` - As above, enable nmbd
|
||||||
* `SMB` - As above, disabel SMB2 minimun version
|
* `SMB` - As above, disabel SMB2 minimun version
|
||||||
* `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT`
|
* `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT`
|
||||||
|
* `WIDELINKS` - As above, allow access wide symbolic links
|
||||||
* `WORKGROUP` - As above, set workgroup
|
* `WORKGROUP` - As above, set workgroup
|
||||||
* `USERID` - Set the UID for the samba server
|
* `USERID` - Set the UID for the samba server
|
||||||
* `GROUPID` - Set the GID for the samba server
|
* `GROUPID` - Set the GID for the samba server
|
||||||
|
14
samba.sh
14
samba.sh
@ -143,6 +143,15 @@ workgroup() { local workgroup="${1}" file=/etc/samba/smb.conf
|
|||||||
sed -i 's|^\( *workgroup = \).*|\1'"$workgroup"'|' $file
|
sed -i 's|^\( *workgroup = \).*|\1'"$workgroup"'|' $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### widelinks: allow access wide symbolic links
|
||||||
|
# Arguments:
|
||||||
|
# none)
|
||||||
|
# Return: result
|
||||||
|
widelinks() { local file=/etc/samba/smb.conf \
|
||||||
|
replace='\1\n wide links = yes\n unix extensions = no'
|
||||||
|
sed -i 's/\(follow symlinks = yes\)/'"$replace"'/' $file
|
||||||
|
}
|
||||||
|
|
||||||
### usage: Help
|
### usage: Help
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# none)
|
# none)
|
||||||
@ -181,6 +190,7 @@ Options (fields in '[]' are optional, '<>' are required):
|
|||||||
-w \"<workgroup>\" Configure the workgroup (domain) samba should use
|
-w \"<workgroup>\" Configure the workgroup (domain) samba should use
|
||||||
required arg: \"<workgroup>\"
|
required arg: \"<workgroup>\"
|
||||||
<workgroup> for samba
|
<workgroup> for samba
|
||||||
|
-W Allow access wide symbolic links
|
||||||
|
|
||||||
The 'command' (if provided and valid) will be run instead of samba
|
The 'command' (if provided and valid) will be run instead of samba
|
||||||
" >&2
|
" >&2
|
||||||
@ -190,7 +200,7 @@ The 'command' (if provided and valid) will be run instead of samba
|
|||||||
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
|
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
|
||||||
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users
|
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users
|
||||||
|
|
||||||
while getopts ":hc:i:nprs:St:u:w:" opt; do
|
while getopts ":hc:i:nprs:St:u:Ww:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
c) charmap "$OPTARG" ;;
|
c) charmap "$OPTARG" ;;
|
||||||
@ -203,6 +213,7 @@ while getopts ":hc:i:nprs:St:u:w:" opt; do
|
|||||||
t) timezone "$OPTARG" ;;
|
t) timezone "$OPTARG" ;;
|
||||||
u) eval user $(sed 's|;| |g' <<< $OPTARG) ;;
|
u) eval user $(sed 's|;| |g' <<< $OPTARG) ;;
|
||||||
w) workgroup "$OPTARG" ;;
|
w) workgroup "$OPTARG" ;;
|
||||||
|
W) widelinks ;;
|
||||||
"?") echo "Unknown option: -$OPTARG"; usage 1 ;;
|
"?") echo "Unknown option: -$OPTARG"; usage 1 ;;
|
||||||
":") echo "No argument value for option: -$OPTARG"; usage 2 ;;
|
":") echo "No argument value for option: -$OPTARG"; usage 2 ;;
|
||||||
esac
|
esac
|
||||||
@ -215,6 +226,7 @@ shift $(( OPTIND - 1 ))
|
|||||||
[[ "${TZ:-""}" ]] && timezone "$TZ"
|
[[ "${TZ:-""}" ]] && timezone "$TZ"
|
||||||
[[ "${SMB:-""}" ]] && smb
|
[[ "${SMB:-""}" ]] && smb
|
||||||
[[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP"
|
[[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP"
|
||||||
|
[[ "${WIDELINKS:-""}" ]] && widelinks
|
||||||
|
|
||||||
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
|
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user