Compare commits
2 commits
58feedfcf7
...
842c32a14e
Author | SHA1 | Date | |
---|---|---|---|
|
842c32a14e | ||
|
c5ddb22e60 |
1 changed files with 21 additions and 7 deletions
28
functions.sh
28
functions.sh
|
@ -1467,14 +1467,28 @@ EOF
|
||||||
eval $SHOPTEXTGLOB
|
eval $SHOPTEXTGLOB
|
||||||
}
|
}
|
||||||
|
|
||||||
chuser () {
|
if ${SSHS-false}
|
||||||
[ $(id -u) -gt 0 ] && return
|
then
|
||||||
u_id="$(id -u $1)"
|
echo declare tsudo
|
||||||
g_id="$(id -g $1)"
|
tsudo () {
|
||||||
install -o ${u_id} -g ${g_id} -m 0700 /run/user/${u_id}
|
[ $(id -u) -gt 0 ] && return 1
|
||||||
cp ${getbashrcfile} /run/user/${u_id}/.
|
[ $# -eq 0 ] && return 2
|
||||||
cp ${getvimrcfile} /run/user/${u_id}/.
|
local u_id="$(id -u $1)"
|
||||||
|
local g_id="$(id -g $1)"
|
||||||
|
local b_rc=$(getbashrcfile)
|
||||||
|
local v_rc=$(getvimrcfile)
|
||||||
|
|
||||||
|
install -d -o ${u_id} -g ${g_id} -m 0700 /run/user/${u_id}
|
||||||
|
|
||||||
|
local bashrctmp="/tmp/$(basename ${b_rc})"
|
||||||
|
local vimrctmp="/tmp/$(basename ${v_rc})"
|
||||||
|
[ -n "${getbashrcfile:-x}" ] && install -o ${u_id} -g ${g_id} -T ${b_rc} "${bashrctmp}"
|
||||||
|
[ -n "${getvimrcfile:-x}" ] && install -o ${u_id} -g ${g_id} -T ${v_rc} "${vimrctmp}"
|
||||||
|
sed -i -e 's;\(bashrctmp=\)\(.*$\);\1'${bashrctmp}';' $bashrctmp
|
||||||
|
sed -i -e 's;\(vimrctmp=\)\(.*$\);\1'${vimrctmp}';' $bashrctmp
|
||||||
|
sudo -u ${1} /bin/bash --rcfile ${bashrctmp}
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
#EOF
|
#EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue