Compare commits

...

2 commits

Author SHA1 Message Date
Jakobus Schürz
842c32a14e rename to tsudo 2024-10-28 17:51:50 +01:00
Jakobus Schürz
c5ddb22e60 debug 2024-10-21 05:44:33 +02:00

View file

@ -1467,14 +1467,28 @@ EOF
eval $SHOPTEXTGLOB
}
chuser () {
[ $(id -u) -gt 0 ] && return
u_id="$(id -u $1)"
g_id="$(id -g $1)"
install -o ${u_id} -g ${g_id} -m 0700 /run/user/${u_id}
cp ${getbashrcfile} /run/user/${u_id}/.
cp ${getvimrcfile} /run/user/${u_id}/.
if ${SSHS-false}
then
echo declare tsudo
tsudo () {
[ $(id -u) -gt 0 ] && return 1
[ $# -eq 0 ] && return 2
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