Unix tips & troubleshooting
GCP - SELinux commands for GitHub Actions runner in CentOS
sudo semanage fcontext --add --type initrc_exec_t /<fullpath>/runsvc.sh
restorecon -v /<fullpath>/runsvc.sh
sudo ./svc.sh start
sudo ./svc.sh status
Generate ed25519 keypair & add to remote SSH
Generate ed25519 keypair:
ssh-keygen -t ed25519 -C "[email protected]"
The public and private key pair will be saved, for example, in ~/.ssh/id_x
and ~/.ssh/id_x.pub
. The .pub
file is the public key.
Configure remote SSH system to accept passwordless login:
- open
~/.ssh/authorized_hosts
in your preferred editor - copy the PUBLIC key to a new line
ssh-ed25519 publicKey [email protected]
SSH - Backspace doesn't work
add to ~/.ssh/config
Host *
SetEnv TERM=xterm-256color
Wiping a drive
dd if=/dev/zero of=/dev/sda bs=512
or
dd if=/dev/random of=/dev/sda bs=512
Can be used to wipe a drive and overwritten with zeroes or randoms. This can be done in a liveboot of gparted to see if the correct drive is selected.
iptables - Open webserver ports (HTTP and HTTPS)
HTTP (80)
sudo iptables -I INPUT -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -I OUTPUT -p tcp --sport 80 -m conntrack --ctstate ESTABLISHED -j ACCEPT
HTTPS (443)
sudo iptables -I INPUT -p tcp --dport 443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -I OUTPUT -p tcp --sport 443 -m conntrack --ctstate ESTABLISHED -j ACCEPT