Warning : this is not a tutorial but more the list of commands I think are useful.
| key | action |
|---|---|
| F2 | BIOS |
| F10 | Boot menu |
bind 'set bell-style none'
sudo apt install openssh-server
sudo ufw allow ssh
sudo apt install tmux
Resume last session :
tmux -a
sudo apt install pv
pv sourcefile > destinationfile
Disable:
sudo systemctl set-default multi-user
Enable:
sudo systemctl set-default graphical
Install ifmetric & net-tools:
sudo apt install ifmetric net-tools
Use route to know which interface is the preferred one :
route -n
Note : the lowest metric is the preferred
Update the metrics with ifmetric:
sudo ifmetric wlp0s20f3 50
Install:
sudo apt install tigervnc-standalone-server
Configure xstartup and paste the code below:
nano ~/.vnc/xstartup
#!/bin/sh
# Start Gnome 3 Desktop
export XDG_SESSION_TYPE=x11
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &
Create and configure service change arrol by your user name
chmod u+x ~/.vnc/xstartup
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=arrol
Group=arrol
WorkingDirectory=/home/arrol
PIDFile=/home/arrol/.vnc/%H:%i.pid
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -localhost no -geometry 1920x1080 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
Enable Service
systemctl daemon-reload
systemctl enable [email protected]
systemctl start [email protected]
Install:
cd ~/Downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
Run:
google-chrome
list UDB devices :
sudo fdisk -l
Mount sda1:
sudo mount -t ntfs /dev/sda1 /media/USB
Mount mmcblk0p1 (SD card):
sudo mount -t ntfs /dev/mmcblk0p1 /media/SD
sudo apt install -y cpu-checker
kvm-ok
sudo apt install qemu qemu-kvm libvirt-daemon bridge-utils virt-manager virtinst
sudo apt install ovmf ebtables dnsmasq
Just follow the steps, there is no trap :)
For windows you first need to download virtio drives (better than standard drivers).
You can setup the windows machine and at the end add virtio image ad cd-rom. Once done, install windows normally until you reach the point where it asks you where to install windows, then load drivers from the virtio drive .iso -> viostor -> w10 -> amd64
Then you can install windows on the hard drive.
List all VMs (on and off)
virsh list --all
Start VM:
virsh start machine_name
Download and install virt-manager
You can connect using your ip address as follow : spice://192.168.1.95:5972
sudo iptables -t nat -I PREROUTING -p tcp -d 192.168.1.95 --dport 3389 -j DNAT --to-destination 192.168.122.59:3389
sudo iptables -I FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT
List iptables rules:
iptables -L
Install:
sudo apt install firewalld
Reset configuration :
rm -rf /etc/firewalld/zones/
List configuration :
sudo firewall-cmd --list-all-zones
firewall-cmd --get-active-zones
Reconfigure zones :
sudo firewall-cmd --remove-interface eno1 --zone=public --permanent
sudo firewall-cmd --add-interface eno1 --zone=external --permanent
sudo firewall-cmd --remove-interface virbr0 --zone=public --permanent
sudo firewall-cmd --add-interface virbr0 --zone=trusted --permanent
sudo firewall-cmd --remove-interface wlp0s20f3 --zone=public --permanent
sudo firewall-cmd --add-interface wlp0s20f3 --zone=external --permanent
sudo firewall-cmd --reload
The ssh port is opened by default
sudo firewall-cmd --zone=external --permanent --add-port=5901/tcp
sudo firewall-cmd --reload
Open ports:
sudo firewall-cmd --zone=external --permanent --add-port=10022/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --zone=external --permanent --add-port=5971/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --zone=external --permanent --add-port=5972/tcp
sudo firewall-cmd --reload
Forward ports ports:
# forward and whitelist ssh port
sudo firewall-cmd --add-forward-port=port=10022:proto=tcp:toport=22:toaddr=192.168.122.21 --zone=external --permanent
sudo firewall-cmd --add-port=10022/tcp --zone=external --permanent
sudo firewall-cmd --reload
# forward and whitelist VNC port
sudo firewall-cmd --add-forward-port=port=5973:proto=tcp:toport=5971:toaddr=192.168.122.21 --zone=external --permanent
sudo firewall-cmd --add-port=5973/tcp --zone=external --permanent
sudo firewall-cmd --reload
# forward and whitelist other port
sudo firewall-cmd --add-forward-port=port=5982:proto=tcp:toport=5982:toaddr=192.168.122.21 --zone=external --permanent
sudo firewall-cmd --add-port=5982/tcp --zone=external --permanent
sudo firewall-cmd --reload
Config file is : /etc/firewalld/direct.xml
Some other commands :
sudo firewall-cmd --permanent --remove-port=3389/tcp
sudo systemctl restart firewalld
sudo systemctl stop firewalld
sudo firewall-cmd --list-all
sudo firewall-cmd --state
sudo firewall-cmd --reload
Edit port line in
nano /etc/ssh/sshd_config
Connect using new port:
ssh [email protected] -p new_port
Install :
apt-get install fail2ban
Backup configuration:
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.backup
Edit configuration as you wish :
nano /etc/fail2ban/jail.conf
Restart Service:
/etc/init.d/fail2ban restart
Download:
cd ~/Downloads
wget https://git.io/vpn -O openvpn-ubuntu-install.sh
Make executable:
chmod -v +x openvpn-ubuntu-install.sh
Install :
sudo ./openvpn-ubuntu-install.sh
Just follow the steps :)
Service commands:
sudo systemctl stop [email protected]
sudo systemctl start [email protected]
sudo systemctl status [email protected]
To uninstall / edit configuration just start the openvpn-ubuntu-install.sh again !
Install:
sudo apt-get install htop
sudo apt-get install lm-sensors
Run:
htop
sensors