AI Hints
Linux · Lesson 94 of 120

SSH: Remote Login

Controlling another computer.

⏱ 2 min read▶ Video at 2:05:27🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Most servers live in data centres, far away, with no screen and no keyboard. So how do people use them? They log in over the network, with SSH, and get a terminal on the remote computer, as if they were sitting in front of it.

SSH: Remote Login
From the video: SSH: Remote Login
  • Servers have no screen
  • Log in over the network
  • SSH: a remote terminal

Logging in

SSH, then a username, an at sign, and the server's name or address. The first time, SSH asks if you trust this server. We type yes. Then it asks for Sam's password on the server, and nothing appears as we type it. Now look at the prompt. Sam at server. Every command we type runs on the server. Exit brings us back.

Terminal
ssh sam@server
The authenticity of host 'server (172.19.0.2)' can't be established.
ED25519 key fingerprint is SHA256:PfsfHGaqeOIwm4xC7/f3q9EfQIF/mzLCOa2nGugy1KI.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'server' (ED25519) to the list of known hosts.
sam@server's password:
sam@server:~$ hostname
server
sam@server:~$ ls
notes.txt  site
sam@server:~$ exit
logout
Connection to server closed.

What just happened

SSH made an encrypted connection to port twenty two on the server. Nobody in between can read what you type, not even your password. The server checked who you are, and then started a shell for you. Everything on screen came back through that secure tunnel.

Encryptednobody can read it
Port 22SSH's door
Remote shellcommands run there
exitclose the connection

Summary

SSH user at server gives you a secure terminal on another computer. The prompt tells you where you are. Exit takes you home. Next, logging in with keys, instead of passwords.

Key takeaways
  • ssh user@server
  • Check the prompt
  • exit to leave
Next up: SSH Keys — safer than passwords