shell-scripte-code/README.md

82 lines
2.1 KiB
Markdown
Raw Normal View History

2022-07-06 23:52:05 +02:00
### shell-scripte
2017-01-15 16:17:27 +01:00
Nützliche shell-scripte
ssh tunnel vom server oder zum server
einrichten mit:
2023-12-13 10:58:58 +01:00
~~~
2017-01-15 16:17:27 +01:00
ssh-keygen -t rsa -b 4096
ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
2023-12-13 10:58:58 +01:00
~~~
2017-01-15 16:17:27 +01:00
oder
2023-12-13 10:58:58 +01:00
~~~
2017-01-15 16:17:27 +01:00
cat id_rsa.pub | ssh server 'cat>> ~/.ssh/authorized_keys'
2023-12-13 10:58:58 +01:00
~~~
2020-09-02 10:04:13 +02:00
2023-08-22 11:51:39 +02:00
### Zum schreiben eines Passworts mittels eines virtuellen Keyboards
2023-12-13 10:52:34 +01:00
2023-12-13 10:58:58 +01:00
https://man.archlinux.org/man/ydotool.1
2023-12-13 10:52:34 +01:00
### ydotool
2023-12-13 10:58:58 +01:00
run deamon with:
~~~
sudo ydotoold
~~~
and run youre command
~~~
sleep 5 && XKB_DEFAULT_LAYOUT=de sudo ydotool type 'Hello World!' -d 20 && notify-send finish
~~~
2023-12-13 10:52:34 +01:00
### mit dotool
2023-12-13 10:58:58 +01:00
~~~
2023-08-22 11:51:39 +02:00
sleep 5 && { echo typedelay 100; echo type ${PASSWORT}; } | DOTOOL_XKB_LAYOUT=de dotool && notify-send done
2023-12-13 10:58:58 +01:00
~~~
2023-08-22 11:51:39 +02:00
2022-07-06 23:52:05 +02:00
### Zum suchen der libinput Treiber mit
2023-12-13 10:58:58 +01:00
~~~
2020-09-02 10:04:13 +02:00
libwacom-list-local-devices
for wort in /usr/share/libwacom/*; do if cat $wort | grep CTL-4100WL; then echo $wort; fi; done
2023-12-13 10:58:58 +01:00
~~~
2022-07-06 23:52:05 +02:00
### Port forwarding using OpenVPN client
2023-12-13 10:58:58 +01:00
~~~
vps# iptables -t nat -A PREROUTING -p tcp --dport 9987 -j DNAT --to-destination 192.168.1.3 (mein Homeserver wenn ich richtig verstanden habe)
vps# iptables -t nat -A POSTROUTING -p tcp --dport 9987 -j MASQUERADE
vps# iptables -t nat -A PREROUTING -p tcp --dport 30033 -j DNAT --to-destination 192.168.1.3
vps# iptables -t nat -A POSTROUTING -p tcp --dport 30033 -j MASQUERADE
vps# iptables -t nat -A PREROUTING -p tcp --dport 10011 -j DNAT --to-destination 192.168.1.3
vps# iptables -t nat -A POSTROUTING -p tcp --dport 10011 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -d 50.xxx.xxx.xxx -p tcp --dport 8081 -j DNAT --to-dest 192.168.2.86:8081
iptables -t nat -A POSTROUTING -d 192.168.2.86 -p tcp --dport 8081 -j SNAT --to-source 10.0.2.42
2023-12-13 10:58:58 +01:00
~~~
2022-07-06 23:52:05 +02:00
### Find and Remove old Syncthing Files
2023-12-13 10:58:58 +01:00
~~~
2022-07-06 23:52:05 +02:00
find -name "*.tmp" -exec rm -vf {} \;
2023-12-13 10:58:58 +01:00
~~~
2022-11-20 20:34:45 +01:00
### Setzt das Repository auf dem aktuellen HEAD zurück und löscht neue Dateien die bis dahin erzeugt wurden
2023-12-13 10:59:33 +01:00
~~~
2022-11-20 20:34:45 +01:00
git reset --hard 8& git clean -dfx
2023-12-13 10:59:33 +01:00
~~~
2022-12-30 23:33:12 +01:00
### Qemu chroot Raspberry PI
2023-12-13 10:59:33 +01:00
~~~
2022-12-30 23:33:12 +01:00
pacman -S qemu-user-static qemu-user-static-binfmt
https://wiki.archlinux.org/title/QEMU#Chrooting_into_arm/arm64_environment_from_x86_64
2023-12-13 10:59:33 +01:00
~~~