Enhance kasmvnc to simplify user permissions management

atif/support-kasm-images
Muhammad Atif Ali 8 months ago
parent df507ca559
commit f63b460971

@ -155,14 +155,13 @@ if ! check_installed; then
;; ;;
esac esac
else else
echo "vncserver already installed. Skipping installation." echo "A binary with name vncserver already installed. Skipping installation."
fi fi
# if sudo is not available, create the config file as the current user .vnc/kasmvnc.yaml # create the config file as the current user .vnc/kasmvnc.yaml
config_path="~/.vnc/kasmvnc.yaml" config_path="~/.vnc/kasmvnc.yaml"
[ sudo -n true ] 2> /dev/null && config_path="/etc/kasmvnc/kasmvnc.yaml"
sudo bash -c "cat > $config_path <<EOF tee $config_path > /dev/null <<EOF
network: network:
protocol: http protocol: http
websocket_port: ${PORT} websocket_port: ${PORT}
@ -170,7 +169,7 @@ network:
require_ssl: false require_ssl: false
udp: udp:
public_ip: 127.0.0.1 public_ip: 127.0.0.1
EOF" EOF
# This password is not used since we start the server without auth. # This password is not used since we start the server without auth.
# The server is protected via the Coder session token / tunnel # The server is protected via the Coder session token / tunnel
@ -179,8 +178,4 @@ echo -e "password\npassword\n" | vncpasswd -wo -u $USER
# Start the server # Start the server
printf "🚀 Starting KasmVNC server...\n" printf "🚀 Starting KasmVNC server...\n"
if sudo -n true 2> /dev/null; then vncserver -select-de ${DESKTOP_ENVIRONMENT} -disableBasicAuth > /tmp/kasmvncserver.log 2>&1 &
sudo -u $USER bash -c "vncserver -select-de ${DESKTOP_ENVIRONMENT} -disableBasicAuth" > /tmp/kasmvncserver.log 2>&1 &
else
vncserver -select-de ${DESKTOP_ENVIRONMENT} -disableBasicAuth > /tmp/kasmvncserver.log 2>&1 &
fi

Loading…
Cancel
Save