SSH is a great way to connect to a remote Linux server over a network. This is how to use SSH easily yourself.
Firstly, install SSH on the remote machine to allow remote connections if it is a server you are setting up.
sudo apt install ssh |
Then run this command on the client to connect to the server.
jason@Yog-Sothoth:~$ ssh jason@192.168.1.4 jason@192.168.1.4's password: Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-144-generic x86_64) * Documentation: https://help.ubuntu.com/ New release '16.04.4 LTS' available. Run 'do-release-upgrade' to upgrade to it. Last login: Tue Apr 24 19:45:03 2018 from blufor.local |
Just provide the SSH password and the login will work. There is also provision for using a key instead of a password to connect to a remote machine.
How to setup an SSH login using host keys instead of a password.
This will allow simple, but secure connections from a client to a server machine. But make sure the host keys cannot be stolen from the server or client machines, this means someone else could logon as you.
How to leave a command running when your SSH session is disconnected.
Useful SSH tricks for downloading files from an SSH server to your machine.
How to show a banner explaining terms of use for an SSH connection before login.
How using ssh is a better way to access your remote machine. How to do this over port 443.
There is also a way to temporarily connect to a remote machine over SSH, run a command, and then exit immediately.
This is an example.
jason@Yog-Sothoth:~$ ssh jason@192.168.1.4 -p 22 -t "ps ax | unity" jason@192.168.1.4's password: WARNING: no DISPLAY variable set, setting it to :0 stop: Unknown job: unity-panel-service start: Unknown job: unity-panel-service compiz (core) - Info: Loading plugin: core compiz (core) - Info: Starting plugin: core compiz (core) - Error: Another window manager is already running on screen: 0 compiz (core) - Info: Stopping plugin: core compiz (core) - Info: Unloading plugin: core Connection to 192.168.1.4 closed. |
This is how to get quick information from a remote machine using a simple one-liner. Very useful indeed.