From 9fb10a95ff4275ca2b82c18c0ed8600cd5575319 Mon Sep 17 00:00:00 2001 From: Super User Date: Mon, 23 Mar 2026 19:11:41 +0800 Subject: remove git and port-forward dirs --- git/set-global_user.sh | 2 -- git/tools/git-ssh-wrapper.sh | 2 -- git/tools/usefulbutnotthatusefulidkwhattodo | 0 port-forward/persistent-ssh.sh | 35 ----------------------- port-forward/rm_all_ssh_connections.sh | 4 --- port-forward/ssh-multiport-forward.sh | 44 ----------------------------- port-forward/ssh-port-forward.sh | 19 ------------- 7 files changed, 106 deletions(-) delete mode 100755 git/set-global_user.sh delete mode 100755 git/tools/git-ssh-wrapper.sh delete mode 100644 git/tools/usefulbutnotthatusefulidkwhattodo delete mode 100755 port-forward/persistent-ssh.sh delete mode 100755 port-forward/rm_all_ssh_connections.sh delete mode 100755 port-forward/ssh-multiport-forward.sh delete mode 100755 port-forward/ssh-port-forward.sh diff --git a/git/set-global_user.sh b/git/set-global_user.sh deleted file mode 100755 index 30e11eb..0000000 --- a/git/set-global_user.sh +++ /dev/null @@ -1,2 +0,0 @@ -git config --global user.email "hc@email.ch" -git config --global user.name "hc" diff --git a/git/tools/git-ssh-wrapper.sh b/git/tools/git-ssh-wrapper.sh deleted file mode 100755 index dc23334..0000000 --- a/git/tools/git-ssh-wrapper.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -ssh -v -A -o ForwardAgent=yes "$@" diff --git a/git/tools/usefulbutnotthatusefulidkwhattodo b/git/tools/usefulbutnotthatusefulidkwhattodo deleted file mode 100644 index e69de29..0000000 diff --git a/port-forward/persistent-ssh.sh b/port-forward/persistent-ssh.sh deleted file mode 100755 index 36d14dd..0000000 --- a/port-forward/persistent-ssh.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -echo "selinux command is untested. copy paste systemd file if you want" -echo "reboot afterwards(selinux unset, need reboot to take effect, or just do sudo setenforce 0 for temp unset)" -echo "make sure /root/m exists" -echo "remember to change the remote port or host if needed" - -# disable selinux -sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config - -sudo cat << 'EOF' > /etc/systemd/system/ssh-tunnel.service -[Unit] -Description=Persistent SSH Tunnel -After=network.target -StartLimitIntervalSec=0 - -[Service] -Type=simple -ExecStart=/usr/bin/ssh \ - -i /root/m \ - -o "ExitOnForwardFailure=yes" \ - -o "StrictHostKeyChecking=no" \ - -N -R 24:localhost:22 root@p.0nom.ch -Restart=always -RestartSec=10 -RemainAfterExit=no -KillMode=process - -[Install] -WantedBy=multi-user.target -EOF - -sudo chmod 600 /root/m -sudo systemctl daemon-reload -sudo systemctl enable --now ssh-tunnel diff --git a/port-forward/rm_all_ssh_connections.sh b/port-forward/rm_all_ssh_connections.sh deleted file mode 100755 index f19300d..0000000 --- a/port-forward/rm_all_ssh_connections.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -ss -tnp | grep ':22' -ps -ef | grep sshd | grep -v grep | awk '{if($3!=1) print $2}' | xargs kill -#sudo systemctl restart sshd diff --git a/port-forward/ssh-multiport-forward.sh b/port-forward/ssh-multiport-forward.sh deleted file mode 100755 index 40d4ef6..0000000 --- a/port-forward/ssh-multiport-forward.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Check if at least one argument is provided -if [ $# -lt 1 ]; then - echo "Usage: $0 [additional_ports...]" - echo "Example: $0 5 80 443" - exit 1 -fi - -# First argument is the base number for port range -j=$1 -shift # Remove first argument from the list, leaving only additional ports - -HOST="root@p.0nom.ch" - -# Clean management port -echo "cleaning management port..." -ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9" -echo "cleaning attempted." - -# Build the SSH command with all port forwards -SSH_CMD="ssh $HOST" - -# Add range-based port forwards (j000-j005) -for i in $(seq ${j}000 ${j}005); do - SSH_CMD+=" -R $i:localhost:$i" -done - -# Add management port forward -SSH_CMD+=" -R ${j}022:localhost:22" - -# Add additional individual port forwards from remaining arguments -for port in "$@"; do - SSH_CMD+=" -R $port:localhost:$port" -done - -# Execute the SSH command -eval $SSH_CMD - -echo "Port forwards are available on:" -echo "- Ports ${j}000-${j}005" -echo "- Management port ${j}022" -if [ $# -gt 0 ]; then - echo "- Additional ports: $@" -fi diff --git a/port-forward/ssh-port-forward.sh b/port-forward/ssh-port-forward.sh deleted file mode 100755 index c4cb0a8..0000000 --- a/port-forward/ssh-port-forward.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# opens 5 ports - -#file will be run from where the user executes the script -j=$1 -HOST="root@p.0nom.ch" - -# get the process holding the specified port and kill it -echo "cleaning management port..." -ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9" -echo "cleaning attempted." - -ssh $HOST $(for i in $(seq ${j}000 ${j}005); do echo "-R $i:localhost:$i"; done; echo "-R ${j}022:localhost:22") - -echo "port forward is available on ports ${j}000-${j}005, ssh on ${j}022" - -#ideally port forward from 2 onwards, there seems to be a problem for 1000(or just change all to j001) -#jupyter lab --port=2001 --ip=0.0.0.0 -- cgit