SSH
Enable service to run at boot:
systemctl enable sshd.service
Start the SSH service:
systemctl start sshd.service
Offending ECDSA key in /home/someuser/.ssh/known_hosts:4
Remove with:
ssh-keygen -f "/home/someuser/.ssh/known_hosts" -R "theservername.com"
Copy SSH public key to remote computer:
ssh-copy-id -i ~/.ssh/id_rsa.pub user@hostname
cat .ssh/id_rsa.pub | ssh username@servername.com "cat > .ssh/authorized_keys"
SSH: Broadcast message: The system will suspend now! client_loop: send disconnect: Broken pipe
You can display the current sleep/suspend settings with a command like this one:
sudo -u gdm dbus-run-session gsettings list-recursively org.gnome.settings-daemon.plugins.power | grep sleep
The problem of getting kicked out of the remote computer when the computer goes into hybernate mode was solved with the following:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Source:
SSH Port Forwarding
Local port forwarding:
To access a web server running on port 80 on a remote server (accessible from ssh_server) from your local machine on port 8080.
Example: The url https://localhost:8080 on your local computer will be forwarded to port 80 on the remote server.
ssh -L 8080:localhost:80 user@ssh_server
Remote port forwarding:
Using -R forwards a port on the remote server to a port on your local machine, or to a port on another machine accessible from your local machine.
Example: The url https://destination_host:3333 will get forwarded to 1234 on my computer or some other computer accessible from my computer.
ssh -R remote_port:destination_host:destination_port user@ssh_server
ssh -R 3333:destination_host:1234 user@ssh_server
Run a command on a remote computer using SSH:
ssh username@servername.com "ls -al"
Compress and send a file from your local computer to a remote computer using SSH:
tar zcvf - TheLocalFile.txt | ssh username@servername.com "cat > SomeRemoteFilename.txt"
Offending ECDSA key in /home/rob/.ssh/known_hosts:XXX
Remove with
ssh-keygen -f "/home/username/.ssh/known_hosts" -R "TheHostName.com"
Example:
ssh-keygen -f "/home/username/.ssh/known_hosts" -R "192.168.1.1"