fixed user creation, some rc files, use hcloud host vars (ipv6)

This commit is contained in:
2024-11-26 18:00:21 +01:00
parent 158048f51d
commit c49dff9ad4
10 changed files with 255 additions and 44 deletions

45
roles/server/files/jlogin Normal file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
jail=$1
user=$2
me=`id -u`
jexec="jexec"
if test "$jail" = "-h"; then
echo "jlogin [jail] [user]"
exit
fi
if test -z "$jail"; then
vars=$(jls -n | head -1)
eval $vars
fi
jid=""
jid=`jls | grep "$jail" | awk '{print $1}'`
if test -z "$jid"; then
echo "jail $jail doesn't run!"
exit 1
fi
shell=/bin/csh
home=/home/$user
term=vt100
path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
chroot="$j/run/$jail"
if test -z "$user"; then
user=root
home=/root
fi
if test -e $chroot/$home/.bashrc; then
shell=/usr/local/bin/bash
fi
if test "$me" != "0"; then
jexec="sudo $jexec"
fi
echo "# Logging into jail $jail with jid $jid #"
env - JAIL=$jail HOME=$home TERM=$term SHELL=$shell PATH=$path $jexec -U $user $jid $shell