User Tools

Site Tools


shutdown_linux

Differences

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

Link to this comparison view

Next revision
Previous revision
shutdown_linux [2024/11/27 12:39] – created torteshutdown_linux [2025/01/21 12:20] (current) torte
Line 1: Line 1:
-====== Sovol SV06+ (mostly) ======+{{page>redirect#this_wiki_has_moved}} 
 +https://torte71.github.io/InsideSovolKlipperScreen/shutdown_linux.html 
 +{{page>redirect#section}} 
 +---- 
 + 
 +====== Sovol SV06+/SV07+ (mostly) ======
 ===== Klipper Shutdown ===== ===== Klipper Shutdown =====
 ===== Linux version ===== ===== Linux version =====
 +
 +==== Requirements ====
 +  * HS110 wifi power plug
 +  * python (should already be on your system, otherwise use ''sudo apt install python3'')
 +  * For simple setup using clear text passwords:
 +    * plink from putty-tools
 +    * install with ''sudo apt install putty-tools''
 +  * For recommended setup using ssh with a key file:
 +    * ssh with a private key generated by ssh-keygen and its public key pasted to the device's ''~./ssh/authorized_keys'' file
 +    * see ''man ssh'' and ''man ssh-keygen'' for further help
 +  * softScheck "tplink_smartplug.py" from https://github.com/softScheck/tplink-smartplug/tree/master
 +
 +==== Setup ====
 +
 +Copy the 5 files ''hs110_off'', ''hs110_on'', ''mks_poweroff '', ''shutdown_sv06'' (from below) and ''tplink_smartplug.py'' (from above link) into a single directory.
 +
 +Make these files executable by using ''chmod +x *''.
 +
 +Have ''putty-tools'' installed (as stated above), unless you have generated ssh keys for passwordless login.
 +
 +Modify ''hs110_off'' and ''hs110_on'', so the IP-address points to your HS110 wifi power plug.
 +
 +Without further modifications, these files should now work for the Sovol KlipperScreen.
 +
 +For other devices, change the variables ''PRINTER'', ''USERNAME'' and ''PASSWORD'' in ''mks_poweroff'' according to your settings.
 +
 +Now you should be able to shutdown and power off the device using clear text passwords by executing ''shutdown_sv06''.\\ 
 +To power it on, execute ''hs110_on''.
 +
 +----
 +
 +To use passwordless login (recommended), you need to generate a key file.\\
 +You can either use putty's plink or standard ssh for that, but the keys need to be generated differently.
 +
 +First create the ".ssh" directory (if not already existing)
 +  * ''mkdir -p ~/.ssh ; chmod 700 ~/.ssh''
 +For plink:
 +  * Use ''puttygen'' to generate the key\\ Example: ''puttygen -t ed25519 -f ~/.ssh/printerkey''
 +  * Use ''puttygen'' again to generate and display the accompanying standard ssh **public** key\\ Example: ''puttygen ~/.ssh/printerkey -L''
 +  * See ''man puttgen'' for further details
 +For standard ssh:
 +  * Use ''ssh-keygen'' to generate the key\\ Example: ''ssh-keygen -t ed25519 -f ~/.ssh/printerkey''
 +  * Use ''cat ~/.ssh/printerkey.pub'' to display the ssh **public** key
 +  * See ''man ssh-keygen'' for further details.
 +  * Set the ''PLINKCMD'' variable in ''mks_poweroff'' to ''ssh''
 +Then
 +  * Make the keyfile unreadable to other users: ''chmod 600 ~/.ssh/printerkey''
 +  * Adjust the ''PLINKKEY'' variable in ''mks_poweroff'' so it points to your private key file (''~/.ssh/printerkey'' in these examples)
 +  * Empty the ''PASSWORD'' variable in ''mks_poweroff''
 +  * Log into the device using ssh and add the **public** key to ''~/.ssh/authorized_keys'':
 +    * ''nano ~/.ssh/authorized_keys''
 +    * Paste the public key line and press "CTRL+X" to quit, press "Y" to confirm once and press "ENTER" to confirm again and quit.
 +  * Allow user "mks" to shutdown/reboot/halt (without "sudo" asking for a password):
 +    * add following line to /etc/sudoers.conf (run ''sudo visudo''):\\ ''mks ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff''\\ (Change "mks" to the real username, if you use a different device than Sovol's KlipperScreen.)
 +
 +Now you should be able to shutdown and power off the device without clear text passwords.
 +
 +----
 +
 +===== Files =====
  
 ==== hs110_off ==== ==== hs110_off ====
Line 34: Line 99:
 PLINKCMD=plink PLINKCMD=plink
 PLINKKEY= PLINKKEY=
-# options for plink with putty key (puttygen)+# options for plink with putty key (created with puttygen)
 #PASSWORD= #PASSWORD=
-#PLINKKEY=printer.ppk +#PLINKKEY=~/.ssh/printerkey 
-# options for standard ssh (ssh-keygen)+# options for standard ssh (key created with ssh-keygen)
 #PASSWORD= #PASSWORD=
-#PLINKKEY=~/.ssh/printer_priv+#PLINKKEY=~/.ssh/printerkey
 #PLINKCMD=ssh #PLINKCMD=ssh
  
shutdown_linux.1732707578.txt.gz · Last modified: 2024/11/27 12:39 by torte