User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
services:wetty [2024/04/24 07:05] – [Start & Autostart] willyservices:wetty [2024/08/07 14:53] (current) willy
Line 17: Line 17:
 Now, as usual,  create a dedicated user since it's not safe to run WeTTY as root: Now, as usual,  create a dedicated user since it's not safe to run WeTTY as root:
 <code bash> <code bash>
-useradd -m wetty+useradd -d /data/daemons/wetty -m wetty
 </code> </code>
  
Line 67: Line 67:
 ===== Start & Autostart ===== ===== Start & Autostart =====
  
-To start WeTTY as a serviceif you follow my [[gentoo:locald|Custom User Services]], create the following script under **/data/daemons/wetty/wetty_start.sh**:+Using OpenRCdrop the following script into /etc/init.d: 
 +<file - /etc/init.d/wetty> 
 +#!/sbin/openrc-run 
 +# Copyright 1999-2021 Gentoo Authors 
 +# Distributed under the terms of the GNU General Public License v2 
 + 
 +description="Web SSH console" 
 +pidfile="/run/wetty.pid" 
 +command_background=true 
 +command="/home/wetty/wetty_start.sh" 
 +command_args="" 
 +command_user="wetty:wetty" 
 + 
 +depend() { 
 +        need net 
 +
 +</file> 
 + 
 +And you will also need to create the following script under **/data/daemons/wetty/wetty_start.sh**:
 <file - wetty_start.sh> <file - wetty_start.sh>
 #!/bin/bash #!/bin/bash
 +
 +export NVM_DIR="$HOME/.nvm"
 +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
 +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
 +
 wetty \ wetty \
  --host 127.0.0.1 \  --host 127.0.0.1 \
Line 78: Line 101:
  --ssh-auth publickey  --ssh-auth publickey
 </file> </file>
 +
 +You need to copy the last lines of the **.bashrc** in the script because NVM requires those lines and OpenRC will run as non-interactive shell, thus bypassing the //.bashrc//.
  
 Note: if you want to leave the user out you can omit the //--ssh-user// part, but then you will need to point your browser to **https://mydomain.com/wetty/ssh/user** to access your console. Note: if you want to leave the user out you can omit the //--ssh-user// part, but then you will need to point your browser to **https://mydomain.com/wetty/ssh/user** to access your console.
Line 83: Line 108:
 And make it executable, then create the links: And make it executable, then create the links:
 <code bash> <code bash>
-cd /etc/local.d +chmod +x /etc/init.d/wetty 
-ln -s _servicer.sh 99-wetty--script.start +chmod +x /home/wetty/wetty_start.sh 
-ln -s _servicer.sh 99-wetty--script.stop+rc-update add wetty default
 </code> </code>
  
 And you are all set. And you are all set.