Creating an SSH Server
Steps to turn a Debian machine into an SSH server accessible from other devices.
Requirements
Operating System | Version |
---|---|
Debian | 10 |
Installation
Refresh the package index.
sudo apt-get update
Install the
openssh-server
package.sudo apt-get install openssh-server
Optional: install
openssh-client
on the machines that will connect to this server.sudo apt-get install openssh-client
Verification
Check the status of the service.
sudo service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-06-01 11:41:07 -04; 5h 34min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 3233 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 3234 (sshd)
Tasks: 1 (limit: 4915)
Memory: 3.3M
CGroup: /system.slice/ssh.service
└─3234 /usr/sbin/sshd -D
...
Auto-start
Control whether the service enables itself at boot.
sudo systemctl enable ssh
To disable auto-start:
sudo systemctl disable ssh
Adjust server settings—such as port and authentication methods—in sshd_config
.
sudo nano /etc/ssh/sshd_config
Useful Commands to Identify the Server
Show the server's IP address.
hostname -I
192.168.32.123
Display the server hostname.
hostname
debian
Display the current username.
whoami
admin
References
Published: June 1, 2020