Skip to content

SSH Basics: Control Your Server from the Command Line

Learn the basics of SSH to control your server from the command line: how the protocol works, connecting with ssh, the difference between passwords and SSH keys and how to generate keys, the most important commands after logging in, transferring files with scp/sftp, securing SSH (disabling root, changing the port, Fail2ban), and fixing common errors.

VPSيوسف الحربي28 min read
Illustration of a terminal linked to a remote server through a padlocked tunnel, representing secure SSH access
On this page

What is SSH and why does it matter to you as a server owner?

When you buy a virtual private server (VPS) or a dedicated server, you don't get a screen and keyboard to sit in front of. The server lives in a data center that may be thousands of kilometers away. The natural question is: how do you control it, then? The answer is SSH.

SSH is a network protocol that lets your computer (the client) connect to another machine (the server) over the internet and open a "shell", that is, a command-line session in which the commands you type run on the remote server as if you were sitting right in front of it. Everything that passes between your computer and the server (passwords, commands, output and files) is encrypted, so no one can eavesdrop on it or modify it in transit.

Before SSH, people used protocols such as Telnet, rlogin and rsh, and they were a security disaster: they sent the password as plain text that anyone listening on the network could read. SSH appeared in 1995 to solve this problem at its root, and today it is the absolute standard for remote server administration on every Unix and Linux system, and even on Windows Server.

Why the command line at all?

You might wonder: why not a graphical panel instead of an intimidating black screen? The answer is that the command line is:

  • Faster and lighter: It doesn't spend server resources drawing an interface; every byte of the server's memory goes to your application.
  • More powerful: A single command can accomplish what would take dozens of clicks in a graphical interface, and it can be automated in scripts.
  • Available on every server: Every Linux distribution comes with SSH ready to go, while graphical interfaces are rare and heavy on servers.
  • Recordable and repeatable: You can save commands, share them and run them on hundreds of servers at once.

If you are still wondering whether you need a server with this level of control at all, see what a VPS is and when you need one to understand the difference between shared hosting and a virtual server you manage yourself.

How does SSH work? Encryption, fingerprints and authentication

To understand SSH in practice, you need to grasp three parts, each of which happens on every connection: establishing an encrypted channel, verifying the server's identity, and verifying your own identity.

1) Establishing the encrypted channel

When you connect, your computer and the server negotiate encryption algorithms and exchange temporary session keys through a mechanism called Diffie-Hellman key exchange. The result is a fast symmetric encrypted channel that protects all data for the rest of the session. This happens automatically, without any action on your part.

2) Verifying the server's identity (the host key and its fingerprint)

Every SSH server has its own key pair, called the host key. On the first connection, the client shows you this key's fingerprint and asks whether you trust it:

bash
The authenticity of host '203.0.113.10 (203.0.113.10)' can't be established.
ED25519 key fingerprint is SHA256:abc123def456...xyz.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

When you type yes, the server's key is stored in the ~/.ssh/known_hosts file on your computer. On later connections, the client automatically compares the server's key with the saved one. If they match, it connects silently; if they differ, it warns you loudly (the server may have been rebuilt, or it may be a man-in-the-middle attack). This fingerprint is your first line of defense against server impersonation.

3) Verifying your identity (authentication)

Once you trust the server, it is your turn to prove who you are. There are two main methods here: a password or a public/private SSH key pair. This is a crucial point, and we devote a whole section to it, because your choice here determines the security level of your entire server.

How SSH key authentication worksYour computer (client)Private keyServerauthorized_keys (public)1 · Connection request (offers the key)2 · Challenge encrypted with the public key3 · Solves it with the private key and sends proof4 · Match ⇒ login without a password
SSH key authentication: your computer keeps the private key and the server keeps the public key; an encrypted challenge is solved with the private key ⇒ secure login without a password.

The diagram above illustrates key authentication: your computer keeps the private key (a secret that never leaves your computer), and the server keeps the public key. The server verifies that you own the matching private key without the private key itself ever being sent over the network.

ComponentWhere does it live?Its role
Client (SSH client)Your local computerStarts the connection and encrypts your requests
Server (SSH daemon / sshd)The remote serverAccepts connections and verifies identity
host keyThe serverProves the server's identity to the client (the fingerprint)
Private keyYour computer onlyProves your identity; never leaves your computer
Public keyThe serverPlaced in authorized_keys to allow you to log in

The first connection: ssh user@ip and port 22

The basic structure of the connect command is simple:

bash
ssh username@server-ip-or-hostname

A real-world example of connecting to a new server as root:

bash
ssh root@203.0.113.10

On the first connection, it will ask you to accept the server's fingerprint (as we saw), then ask for the password. Type it (no characters will appear on the screen, which is normal for security reasons) and press Enter. If it works, you will find yourself at the server's command prompt, like this:

bash
root@my-server:~#

Congratulations: you are now inside your server.

Specifying the port and user explicitly

SSH listens on port 22 by default. If you change the port (we will explain later why you might), specify it with the -p flag:

bash
ssh -p 2222 username@203.0.113.10
PartExampleMeaning
The commandsshThe SSH client program
The -p flag-p 2222Connection port (22 by default)
Userusername@The name of the user account on the server
Host203.0.113.10The server's IP or domain name

Note: port 22 is the standard SSH port. Remember that it is the default port that must be open in the firewall for you to be able to connect.

To leave the session at any time, type exit or press Ctrl+D:

bash
exit

Passwords vs. SSH keys: why keys are far more secure

This is the most important point in the entire guide. Many breaches start with a server that accepts logins with a weak or guessable password. SSH keys solve the problem at its root.

A password is a shared secret known to both sides; it can be guessed with brute-force attacks, leaked, or captured through phishing. And since servers face thousands of automated login attempts every day, a single weak password is enough to cause a disaster.

An SSH key is a mathematical pair: a private key that stays only on your computer, and a public key that you place on the server. When you log in, your computer proves that it owns the private key through a cryptographic challenge, without the private key itself being sent. A private key (ed25519 or RSA 4096) is practically impossible to guess by brute force.

CriterionPasswordSSH key
Strength against brute forceWeak to moderateVery strong (practically impossible)
What travels over the networkSent (encrypted)The private key is never sent
Risk of leakingHigh (phishing, reuse)Low (the private key never leaves your computer)
Ease of automationLimited (requires input)Excellent (non-interactive login)
Everyday convenienceYou type it every timeInstant login without typing
Managing multiple usersComplicatedEasy (one public key per person)
Extra protection—A passphrase on the key

The bottom line: always use SSH keys, and disable password login once you have confirmed that your key works. This is the single most important security measure you can take for your server.

Generating SSH keys and copying them to the server

The process has three steps: generate the key pair on your computer, copy the public key to the server, and test the login.

Step 1: Generate the key pair with ssh-keygen

Open a terminal on your computer (not on the server) and run:

bash
ssh-keygen -t ed25519 -C "your_email@example.com"

It will ask where to save the key (accept the default ~/.ssh/id_ed25519 by pressing Enter), then for a passphrase, an extra layer of protection that encrypts the private key itself on your disk. Setting a passphrase is strongly recommended: that way, even if your computer is stolen, the key can't be used without it.

The result is two files in the ~/.ssh folder:

  • id_ed25519: the private key (never share it with anyone).
  • id_ed25519.pub: the public key (this is the one you put on servers).

The ed25519 type is the currently recommended choice: short, fast and very secure. If you have an old system that doesn't support it, use RSA with a length of 4096 bits:

bash
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
FlagExampleFunction
-t-t ed25519Key type (ed25519 recommended, or rsa)
-b-b 4096Key length in bits (for RSA; ed25519 is fixed)
-C-C "email"A comment to identify the key (usually an email or description)
-f-f ~/.ssh/work_keyPath/file name of the output key
-N-N "passphrase"Set the passphrase directly (for scripts)
-p-pChange the passphrase of an existing key

Step 2: Copy the public key to the server with ssh-copy-id

The easiest way to install your public key on the server:

bash
ssh-copy-id username@203.0.113.10

It will ask for the server password one last time, then automatically add your public key to the ~/.ssh/authorized_keys file on the server and set the correct permissions. If you use a custom port:

bash
ssh-copy-id -p 2222 username@203.0.113.10

If ssh-copy-id is not available (common on Windows), copy the key manually:

bash
cat ~/.ssh/id_ed25519.pub | ssh username@203.0.113.10 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Step 3: Test the login

Now try connecting:

bash
ssh username@203.0.113.10

You should get in right away (or after entering the key's passphrase, if you set one) without being asked for the server password. If that works, you are ready to disable password login later.

Setting up keys is part of a complete server setup sequence. To see the full picture, from the moment you buy the server to securing it and running your application, see the guide to setting up your first VPS from scratch.

First VPS setup: the steps in order1 · Connect over SSHSecure server login2 · Update the systemapt update && upgrade3 · Non-root user+ SSH keys4 · Firewall (UFW)Open only the ports you need5 · Install the web stackNginx · PHP · database6 · SSL certificateHTTPS via Certbot
First VPS setup in order: SSH → system update → non-root user and keys → firewall → web stack → SSL.

The diagram above summarizes the flow of setting up a new server: you connect first, create a non-root user, install your key, secure SSH, then install your software. SSH is the gateway to every step that follows.

The ~/.ssh/config file: shortcuts that save you time

If you manage several servers, you will get tired of typing the user, IP and port every time. The ~/.ssh/config file on your computer solves that. Create or edit it:

bash
nano ~/.ssh/config

And add a block for each server:

bash
Host myserver
    HostName 203.0.113.10
    User deploy
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

Host db
    HostName 198.51.100.20
    User admin
    Port 22
    IdentityFile ~/.ssh/db_key

Now, instead of a long command, you just type:

bash
ssh myserver
OptionExampleFunction
HostHost myserverThe short name you type
HostName203.0.113.10The actual server address
UserdeployThe default username
Port2222The port
IdentityFile~/.ssh/id_ed25519The private key used for this server
ServerAliveInterval60Send a keepalive every 60 seconds to prevent the session from dropping

Make sure the file's permissions are correct, or SSH will ignore it:

bash
chmod 600 ~/.ssh/config

The most important commands after logging in

Once you are logged in, you are in a Linux environment. These are the most commonly used commands, grouped by purpose.

bash
pwd                 # print the current path
ls -lah             # list files in detail, with sizes and hidden files
cd /var/www         # change to a directory
cd ..               # go up one directory
cd ~                # go to your home directory

Managing files and folders

bash
mkdir projects              # create a directory
touch index.html            # create an empty file
cp file.txt backup.txt      # copy a file
mv old.txt new.txt          # move/rename
rm file.txt                 # delete a file
rm -r folder                # delete a directory and its contents (careful!)
cat file.txt                # print a file's contents
less /var/log/syslog        # page through a long file (q to quit)
nano config.txt             # edit a file in a simple editor

Permissions and ownership

bash
chmod 600 ~/.ssh/id_ed25519     # read/write for the owner only
chmod 755 script.sh             # execute for everyone, write for the owner
chown deploy:deploy file.txt    # change the file's owner and group

Administrative privileges with sudo

A regular user doesn't have system privileges; you borrow root privileges temporarily with sudo:

bash
sudo apt update                 # update the package lists
sudo apt install nginx          # install a program
sudo systemctl restart nginx    # restart a service

Monitoring the system and services

bash
top                             # watch processes and resources live (q to quit)
df -h                           # disk space
free -h                         # memory usage
systemctl status nginx          # status of a specific service
journalctl -u nginx -n 50       # last 50 lines of the service logs
The commandFunctionExample
lsList filesls -lah
cdChange directorycd /var/www
cp / mv / rmCopy/move/deletecp a b
chmod / chownPermissions/ownershipchmod 644 file
sudoAdministrative privilegessudo apt update
systemctlManage servicessystemctl restart nginx
top / df / freeMonitor resourcesdf -h
journalctlRead logsjournalctl -u nginx

A practical tip: get used to Tab to autocomplete file names, and to the up arrow to recall previous commands. These two alone will double your speed.

Transferring files: scp, sftp and rsync

Controlling a server isn't complete without moving files to and from it. You have three tools, all of which run over encrypted SSH.

scp: quick, direct copying

scp (secure copy) is the simplest for one-off copies. The pattern: scp source destination.

Upload a file from your computer to the server:

bash
scp ./report.pdf username@203.0.113.10:/home/username/

Download a file from the server to your computer:

bash
scp username@203.0.113.10:/var/log/app.log ./

Copy an entire folder (with the -r flag), and with a custom port (a capital -P for scp):

bash
scp -r -P 2222 ./site username@203.0.113.10:/var/www/
FlagFunction
-rCopy a directory recursively
-P 2222Specify the port (note: capital P in scp)
-i keySpecify a particular private key
-CCompress data during transfer

sftp: an interactive file management session

sftp opens an interactive session in which you navigate and transfer files with FTP-like commands, but encrypted:

bash
sftp username@203.0.113.10

Inside the session:

bash
ls                  # server files
lls                 # files on your local computer (local ls)
cd /var/www         # navigate on the server
put localfile.txt   # upload a file
get remotefile.txt  # download a file
put -r myfolder     # upload a directory
bye                 # quit

rsync: smart syncing for large files

rsync is the most powerful for syncing and backups: it transfers only the differences, so it can resume and it speeds up large updates:

bash
rsync -avz -e "ssh -p 2222" ./site/ username@203.0.113.10:/var/www/site/
FlagFunction
-aArchive mode (preserves permissions and timestamps)
-vVerbose output
-zCompression during transfer
-e "ssh -p 2222"Specify the port/SSH options
--deleteDelete whatever no longer exists in the source (careful)
--dry-runSimulate without actually running (for testing)
ToolBest forInteractive?Incremental transfer?
scpA quick one-off copyNoNo
sftpBrowsing and managing files manuallyYesNo
rsyncSyncing and recurring backupsNoYes

Securing SSH: the most important steps after setup

Your server on the public internet faces automated break-in attempts around the clock. These measures shrink the attack surface considerably. All of them are made in the SSH server's configuration file:

bash
sudo nano /etc/ssh/sshd_config

After any change, test the configuration, then restart the service:

bash
sudo sshd -t                      # check the configuration is valid before restarting
sudo systemctl restart ssh        # or: sudo systemctl restart sshd

Critical warning: after making changes, don't close your current session until you have opened a new session in a separate window and confirmed that it works. If you make a configuration mistake and close your session, you may lock yourself out of your server.

1) Create a non-root user and disable root login

The most dangerous thing is allowing root to log in directly over SSH, because attackers always know its name. Create a regular user with sudo privileges first:

bash
adduser deploy
usermod -aG sudo deploy

Copy your key to this user (ssh-copy-id deploy@...), test the login, then disable root login in sshd_config:

bash
PermitRootLogin no

2) Disable password authentication

Once you have confirmed that your key works fully, disable passwords to shut the door on guessing for good:

bash
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no

3) Restrict which users are allowed

Allow only specific users to log in over SSH:

bash
AllowUsers deploy admin

4) Change the default port (optional)

Changing the port from 22 provides no real security (security through obscurity), but it noticeably reduces the noise of automated login attempts in your logs:

bash
Port 2222

Remember to open the new port in the firewall before restarting, or you will be locked out:

bash
sudo ufw allow 2222/tcp
sudo ufw delete allow 22/tcp     # after confirming that 2222 works
sudo ufw enable
Setting in sshd_configRecommended valueEffect
PermitRootLoginnoPrevents direct root login
PasswordAuthenticationnoEliminates password guessing
PubkeyAuthenticationyesEnables key authentication
AllowUsersdeployRestricts login to specific users
Port2222Reduces the noise of automated attacks
MaxAuthTries3Limits authentication attempts per connection
LoginGraceTime30Drops hanging connections quickly

5) Install Fail2ban to block attackers automatically

Fail2ban monitors the login logs, and when it detects several failed attempts from a single IP, it automatically blocks that IP in the firewall for a period of time:

bash
sudo apt update
sudo apt install fail2ban
sudo systemctl enable --now fail2ban

Create a local configuration so your customizations aren't wiped out by updates:

bash
sudo nano /etc/fail2ban/jail.local

And add:

bash
[sshd]
enabled = true
port = 2222
maxretry = 4
bantime = 3600
findtime = 600

Restart it and check the status:

bash
sudo systemctl restart fail2ban
sudo fail2ban-client status sshd

These same principles (least privilege, restricted access, blocking failed attempts) apply to every administration interface on your server, not just SSH. If you also run a control panel, apply the same logic as in the guide to securing cPanel.

SSH clients: Windows, macOS and Linux

The connection tool differs slightly depending on your local computer's operating system.

macOS and Linux

Both come with a built-in OpenSSH client. Open the Terminal app and type the ssh command directly. Every command in this guide works without any additional installation.

Windows

You have two excellent options:

  1. OpenSSH built into PowerShell: Windows 10/11 come with a ready-to-use OpenSSH client. Open PowerShell and type the ssh, scp and ssh-keygen commands exactly as you would on Linux. This is the simplest option and the one recommended today.
  2. PuTTY: A long-established graphical program. You enter the server address and port in a windowed interface. For keys, PuTTY uses its own .ppk format generated with the PuTTYgen tool, and you transfer files with the companion pscp tool.
SystemDefault clientHow to start
LinuxBuilt-in OpenSSHTerminal → ssh user@ip
macOSBuilt-in OpenSSHTerminal → ssh user@ip
Windows 10/11OpenSSH in PowerShellPowerShell → ssh user@ip
Windows (alternative)PuTTY + PuTTYgenGraphical interface + .ppk keys

Managing keys and the ssh-agent

If you set a passphrase on your key (which is the right thing to do), you will be asked for it on every connection. This is where ssh-agent comes in: a program that keeps your decrypted key in memory for the whole session, so you enter the passphrase only once.

Start the agent and add your key:

bash
eval "$(ssh-agent -s)"      # start the agent
ssh-add ~/.ssh/id_ed25519   # add the key (you enter the passphrase once)
ssh-add -l                  # list the keys currently loaded
The commandFunction
ssh-add keyAdd a key to the agent
ssh-add -lList loaded keys
ssh-add -d keyRemove a specific key
ssh-add -DRemove all keys

Tips for managing keys securely:

  • One key per person, not a shared key: That way you can revoke one person's access by deleting only their key.
  • Back up your private key in a safe, encrypted place: losing it means losing your access (if you have disabled passwords).
  • Rotate keys regularly for sensitive accounts, and remove old ones from authorized_keys.
  • Never upload your private key to a Git repository or an unencrypted cloud service.

Troubleshooting common errors

The most common SSH error messages and their direct fixes.

Permission denied (publickey)

This means the server rejected your key. Common causes: the public key is not in authorized_keys, the .ssh folder has the wrong permissions, or you are using the wrong username. Fix the permissions on the server:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

For detailed diagnosis, connect in verbose mode to see which key is being tried and why it is rejected:

bash
ssh -v username@203.0.113.10

Host key verification failed

The server's key has changed from the one saved in known_hosts. The reason may be legitimate (the server was rebuilt) or dangerous (impersonation). If you are sure the change is legitimate, delete the old entry:

bash
ssh-keygen -R 203.0.113.10

Then reconnect and accept the new fingerprint.

Connection refused / Connection timed out

refused means the machine rejected the connection on that port (the SSH service is stopped or the port is closed). timed out means it didn't respond at all (the server is off, the IP is wrong, or a firewall is dropping the packets). Check:

bash
# on the server (if you can reach it another way): make sure SSH is running
sudo systemctl status ssh
# make sure the port is open in the firewall
sudo ufw status

Too many authentication failures

The client tries so many keys that it exceeds the server's limit before reaching your correct key. Force a single key:

bash
ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 username@203.0.113.10
ErrorMost likely causeFix
Permission denied (publickey)Key not installed or wrong permissionsCheck authorized_keys and chmod 600
Host key verification failedThe server's key changedssh-keygen -R host, then reconnect
Connection refusedSSH service stopped or port closedStart sshd and open the port
Connection timed outServer off, or IP/firewall issueCheck the IP, the server status and the firewall
Too many authentication failuresToo many keys triedUse -o IdentitiesOnly=yes -i key
WARNING: UNPROTECTED PRIVATE KEYPrivate key permissions are too openchmod 600 ~/.ssh/id_ed25519

Expert tips and common beginner mistakes

  • Don't disable passwords before testing your key: This is the most common reason people get locked out of their server. Open a new session with the key and confirm that it works before disabling anything.
  • Don't always work as root: Create a user with sudo privileges and work as that user; it reduces the risk of catastrophic commands and leaves an audit trail.
  • Use tmux or screen for long tasks: If your connection drops during a long operation (an update, a backup), it may stop. These tools keep the session alive on the server.
  • Enable ServerAliveInterval in ~/.ssh/config to stop firewalls from dropping idle sessions.
  • Keep a copy of your private key in a password manager or on encrypted media; losing it means losing access.
  • Review authorized_keys regularly and remove the keys of people who no longer need access.
  • Be careful with rm -r and rm -rf: There is no undo and no recycle bin on the server. Double-check the path.

Frequently asked questions

What is the difference between SSH and SSL/TLS? Both use encryption, but for different purposes. SSH is a protocol for logging in securely, controlling a remote server from the command line and transferring files. SSL/TLS is a protocol for securing connections between browsers and websites (https). In short: SSH is for managing the server, and TLS is for securing visits to your site.

Do I need to know Linux before using SSH? SSH itself is easy: one command to connect. But once you are logged in, you will need basic Linux commands (navigation, files, permissions, sudo) to get anything useful done. The commands section of this guide is enough to get started, and you will learn the rest through practice.

Is port 22 secure, or should I change it? Port 22 is secure in itself; security comes from encryption and authentication, not from the port number. Changing the port is "security through obscurity" and won't stop a serious attacker, but it does reduce the noise of automated login attempts in your logs. Far more important is disabling root login and password login and using keys.

What if I lose my private key? If password login is still enabled, log in with your password, then generate a new key and install it. If you have disabled password login, you will need your provider's panel console (console/VNC or rescue mode) to log in and install a new key. That is why it is always recommended to keep an encrypted backup of your private key.

What is the difference between ed25519 and RSA? Both are key types. ed25519 is newer: its keys are shorter and faster, and its security is excellent, which is why it is the recommended choice today. RSA is older and more widely compatible with very old systems, but it needs 4096 bits to match the security of ed25519. Choose ed25519 unless you are dealing with an old system that doesn't support it.

Can several people log in to the same server over SSH? Yes, and that is the right way to do it. Give each person their own user and put their public key in the authorized_keys file of their own account. That way you can track who did what, and you can revoke one person's access by deleting their key without affecting anyone else.

Why don't the password characters appear as I type? This is deliberate security behavior in Linux: no asterisks or characters appear, so no one can see how long your password is. Type it with confidence and press Enter; it is actually being recorded even though the screen stays blank.

What is the difference between scp, sftp and rsync? All three transfer files over SSH. scp is the simplest for a quick one-off copy. sftp is an interactive session in which you browse and transfer manually. rsync is the smartest for syncing and backups because it transfers only the differences and can resume, which saves a lot of time on repeated updates.

Is SSH free? Yes. OpenSSH, the most widely used client and server implementation, is open source and completely free, and it is included in every Linux distribution, macOS and Windows 10/11. There are no licensing costs at all.

How do I keep an SSH session running after I shut down my computer? The session itself ends when you shut down your computer, but you can run long processes inside tmux or screen on the server. They keep running in the background even if your connection drops, and you can return to them later with the tmux attach command. This is essential for updates, backups and any task that must not stop.

Can I use SSH for tunneling and port forwarding? Yes, and it is a powerful feature. SSH can create encrypted "tunnels" that forward a port from your computer to a service on the server (for example, to reach an internal database securely without exposing it to the internet). This is an advanced topic, but it shows that SSH is more than just a remote command line.

Conclusion

SSH is your key, literally and figuratively, to full control of your server. You have learned how it works (encryption, the host key fingerprint, authentication), how to connect with ssh user@ip, why SSH keys are far more secure than passwords and how to generate and copy them, the most important Linux commands after logging in, how to transfer files with scp, sftp and rsync, how to secure SSH by disabling root and password login and installing Fail2ban, and how to fix the most common errors. Start today by generating an ed25519 key and installing it on your server, then disable password login once you have confirmed it works. That step alone takes you from a server exposed to guessing to a hardened one.

Frequently asked questions

What is the difference between SSH and SSL/TLS?

Both use encryption, but for different purposes. SSH is a protocol for logging in securely, controlling a remote server from the command line and transferring files. SSL/TLS is a protocol for securing connections between browsers and websites (https). In short: SSH is for managing the server, and TLS is for securing visits to your site.

Do I need to know Linux before using SSH?

SSH itself is easy: one command to connect. But once you are logged in, you will need basic Linux commands (navigation, files, permissions, sudo) to get anything useful done. The commands section of this guide is enough to get started, and you will learn the rest through practice.

Is port 22 secure, or should I change it?

Port 22 is secure in itself; security comes from encryption and authentication, not from the port number. Changing the port is "security through obscurity" and won't stop a serious attacker, but it does reduce the noise of automated login attempts in your logs. Far more important is disabling root login and password login and using keys.

What if I lose my private key?

If password login is still enabled, log in with your password, then generate a new key and install it. If you have disabled password login, you will need your provider's panel console (console/VNC or rescue mode) to log in and install a new key. That is why it is always recommended to keep an encrypted backup of your private key.

What is the difference between ed25519 and RSA?

Both are key types. ed25519 is newer: its keys are shorter and faster, and its security is excellent, which is why it is the recommended choice today. RSA is older and more widely compatible with very old systems, but it needs 4096 bits to match the security of ed25519. Choose ed25519 unless you are dealing with an old system that doesn't support it.

Can several people log in to the same server over SSH?

Yes, and that is the right way to do it. Give each person their own user and put their public key in the authorized_keys file of their own account. That way you can track who did what, and you can revoke one person's access by deleting their key without affecting anyone else.

Why don't the password characters appear as I type?

This is deliberate security behavior in Linux: no asterisks or characters appear, so no one can see how long your password is. Type it with confidence and press Enter; it is actually being recorded even though the screen stays blank.

What is the difference between scp, sftp and rsync?

All three transfer files over SSH. scp is the simplest for a quick one-off copy. sftp is an interactive session in which you browse and transfer manually. rsync is the smartest for syncing and backups because it transfers only the differences and can resume, which saves a lot of time on repeated updates.

Is SSH free?

Yes. OpenSSH, the most widely used client and server implementation, is open source and completely free, and it is included in every Linux distribution, macOS and Windows 10/11. There are no licensing costs at all.

How do I keep an SSH session running after I shut down my computer?

The session itself ends when you shut down your computer, but you can run long processes inside tmux or screen on the server. They keep running in the background even if your connection drops, and you can return to them later with the tmux attach command. This is essential for updates, backups and any task that must not stop.

Can I use SSH for tunneling and port forwarding?

Yes, and it is a powerful feature. SSH can create encrypted "tunnels" that forward a port from your computer to a service on the server (for example, to reach an internal database securely without exposing it to the internet). This is an advanced topic, but it shows that SSH is more than just a remote command line.