In this example I will use watch to repeat the call of ls -l
watch -n 5 -d ls -l /home/user/
-n = interval in seconds
-d = differences
In this example I will use watch to repeat the call of ls -l
watch -n 5 -d ls -l /home/user/
-n = interval in seconds
-d = differences
The purpose of the package unattended-upgrades is to keep your server current with the latest security updates. Or call it automatic updates. Install and configure unattended-upgrades.
Do this as root user or use sudo:
apt install unattended-upgrades apt-listchanges
Now configure unattended-upgrades:
dpkg-reconfigure -plow unattended-upgrades
That’s it.
Genrate SSH keypair:ssh-keygen -t ed25519
Remove host from ~/.ssh/known_hosts:ssh-keygen -R <host>
Copy local ssh-key to another server:ssh-copy-id <host>
Connect to a server over a jump host – hopping:ssh -t user@jumphost ssh user@target
update: since OpenSSH 7.3 it is possible to shorten this a bit more:ssh -J user@jumphost user@target
Connect to port 80 on a remote server and build a tunnel to port 8000 on localhost:ssh -L 8000:localhost:80 server -N
this command mounts a directory from a remote machine into a local directory:sshfs user@host:/path/on/host /local/path</pre>
must to be enabled in ssh_config and sshd_config:ssh -X user@server <programm> &
ssh remotehost 'dpkg --get-selections' | dpkg --set-selections && dselect install
-N = Do not execute a remote command
-t = Force pseudo-terminal allocation
-V = Display the version number
-J = This is a shortcut to specify a ProxyJump
Run a command on a group of nodes, using only SSH and pee:
echo "uptime" | pee "ssh host1" "ssh host2" "ssh host3"
How to safe an entire website with wget:
wget --recursive --page-requisites --convert-links www.test.com
Sometimes, for several reasons, it is necessary to renew the ssh keys of a host. Most Linux and Unix distributions create ssh keys during the installation of the OpenSSH server or similar packages. If you want to clone a VM in KVM or a container system these keys should be changed.
do all the steps below as root user or use sudo
rm -v /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
Restart ssh server
systemctl restart sshd
in your local known_hosts file Use the editor of your choice to edit the ./ssh/known_hosts file, or use ssh-keygen to delete the host.
ssh-keygen -R remote-host
That’s it.