fixed user creation, some rc files, use hcloud host vars (ipv6)
This commit is contained in:
45
roles/server/files/jlogin
Normal file
45
roles/server/files/jlogin
Normal 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
|
||||
Reference in New Issue
Block a user