ã¹ãããã家ã®PCãã¹ã¦ã®é»æºãè½ã¨ããããã«ãããã¨æããè²ã 調ã¹ããæçµçã«ã¯ãsshã使ã£ã¦åPCã§shutdownã³ãã³ããå®è¡ããæ¹æ³ã«è½ã¡çããã
Termuxã¢ããªã®ã¤ã³ã¹ãã¼ã«
ã¹ããããsshã³ãã³ããå®è¡ããããã«ã以ä¸ã®è¨äºãåèã«ä½æ¥ãã¾ããã
https://qiita.com/Maki-HamarukiLab/items/05ccabba68703a7d7892
GitHubã®å ¬å¼æ å ±ã«ããã°ãPlayã¹ãã¢çã¯å®é¨ãã©ã³ããããã®ã§ãGitHubãããªãªã¼ã¹çï¼v0.118.1ï¼ããã¦ã³ãã¼ããã¾ãããã¡ãªã¿ã«ãèªåã®ã¹ãããARMv8ã ã£ãã®ããç¥ããªãã£ãã®ã§ããããã調ã¹ã¾ããã*1
Termuxã®åæã»ããã¢ãã
åºæ¬çã«åç §ãµã¤ãã®ã¾ã¾ã
pkg update pkg upgrade termux-setup-storage pkg install openssh sshd ip a
ãã ãip aãå®è¡ãã㨠Cannot bind netlink socket: Permission denied
ã¨åºãã®ã§ã代ããã« ifconfig
ã使ãã¾ããã
ãã®å¾ãã¦ã¼ã¶ã¼å確èªã¨ãã¹ã¯ã¼ãè¨å®ããã¾ããã
whoami passwd
PCããTermuxã«SSHæ¥ç¶
ä½æ¥å¹çãä¸ããããã«ãPCããTermuxã«SSHã§æ¥ç¶ããã
ssh -p 8022 <ã¦ã¼ã¶ã¼å>@<wlan0ã®ã¢ãã¬ã¹>
ããã§PCãããã°ã¤ã³ã§ããããã«ãªããã ãã¶ä½æ¥ã楽ã«ãªãã¾ããBluetoothãã¼ãã¼ããããã¨ããã«ä¾¿å©ããã
å¿ è¦ãªãã¼ã«ããã®ã¿ã¤ãã³ã°ã§ã¤ã³ã¹ãã¼ã«ãã¾ããã
pkg install vim
å ¬ééµèªè¨¼ã®è¨å®
PCå´ã§ã¯ãã§ã«éµãæã£ã¦ããããRSAãå¤ãã£ãã®ã§ãããæ©ã«ä½ãç´ããã
# PCå´ ssh-keygen -t ed25519 # å¿ è¦ãªãéµãçæ scp -P 8022 id_ed25519.pub <Termuxã¦ã¼ã¶ã¼å>@<Termuxã¢ãã¬ã¹>: # Termuxå´ mkdir ~/.ssh cat ~/id_ed25519.pub >> ~/.ssh/authorized_keys
ããã«ãTermuxããPCã¸ããã°ã¤ã³ã§ããããã«ãéæ¹åã®è¨å®ãè¡ãã¾ããã
ã·ã§ã¼ãã«ããããã¹ã¯ãªãããå®è¡ããè¨å®
Termux:Widgetã®ã¤ã³ã¹ãã¼ã«
ã·ã§ã¼ãã«ãããä½ãããã«ãGitHubãããªãªã¼ã¹çãã¤ã³ã¹ãã¼ã«ãã¾ããã
Termuxã®~/.shortcuts/ãã£ã¬ã¯ããªã«ã¹ã¯ãªãããé
ç½®ãã¾ãï¼ãªããã°ä½æï¼ã
mkdir -p ~/.shortcuts cp your-script.sh ~/.shortcuts/ chmod +x ~/.shortcuts/your-script.sh
ãã¼ã ç»é¢ã«ã¦ã£ã¸ã§ããã追å
Androidã®ãã¼ã ç»é¢ã«ã¦ã¦ã£ã¸ã§ããã追å ããæä½ãè¡ãããTermux:Widgetãã追å ãã¾ãã
ã2x2ãã§ã¯ãªãã1x1ãã® Termux shortcut
ãé¸ã¶ã¨ãç»é²ããã¹ã¯ãªãããåå¥ã«ã·ã§ã¼ãã«ããã¨ãã¦é
ç½®ã§ãã¾ãã
家ã®PCã®é»æºãä¸æ¬ã§è½ã¨ãå±éºãªã¹ã¯ãªãããªã®ã§ãHomeç»é¢ã®æ®æ®µä½¿ããªãé¢åãããå ´æã«ã³ãã½ãªã¨ç½®ãã¾ããã
sshã§ã·ã£ãããã¦ã³ãè¡ãã·ã§ã«ã¹ã¯ãªãã
æåã¯ã©ã®PCãåã poweroff
ã³ãã³ãã§ãããã¨æã£ãã®ã§ãããçµæçã«PCãã¨ã«å¯¾å¿ãå¿
è¦ã§ããã
#!/bin/bash # XigmaNas ssh user_name@address "poweroff" & # Manjaro Linux ssh -tt user_name@address "systemctl poweroff" & # Windows ssh user_name@address "shutdown /s /t 0" &
åOSãã¨ã®è¨å®
XigmaNASã®è¨å®
ç¹ã«ä½ãèããã«sshdãèµ·åããããè¨å®ä¸è¶³ã§ãã¾ãåãã¾ããã§ãããWebã¤ã³ã¿ã¼ãã§ã¼ã¹ã®ããµã¼ãã¹âSSHãã§ãå ¬ééµèªè¨¼ã許å¯ãã«ãã§ãã¯ãå ¥ããå¿ è¦ãããã¾ããã
Manjaro Linuxã®è¨å®
è¦æ¦ãã¦ãè²ã
ã¨è¨å®ã触ã£ãçµæãä½ãå¹ããã®ãåãããªããæå¾ã«å¹æããã£ãã®ã¯ã /etc/polkit-1/rules.d/50-nopasswd-poweroff.rules
ã追å ãã¦ãwheelã°ã«ã¼ãã®ã¦ã¼ã¶ã¼ããã¹ã¯ã¼ãç¡ãã§systemctl poweroffãå®è¡ã§ããããã«ããã
polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.login1.power-off" && subject.isInGroup("wheel")) { return polkit.Result.YES; } });
Windowsã®è¨å®
sshdã®ã¤ã³ã¹ãã¼ã«ãsshdã®ç«ã¡ä¸ãã¯çç¥ã
éµèªè¨¼ã§ãã°ã¤ã³ã§ããè¦æ¦ãã¾ãããåå ã¯ãsshd_configã®ä»¥ä¸ã®è¨å®ã§å¥ã®authorized_keysãåç §ãã¦ããããã§ããããããã³ã¡ã³ãã¢ã¦ãããã解決ãã¾ããã
Match Group administrators AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys