Installing SSH
To install SSH, nothing is easier than this. Just issue the following command in the terminal as a root user.
The command is:
Code:
Code:
sudo apt-get install ssh
Note: If you are already logged into superuser (root), you should not do sudo.
That's it. You have installed SSH. In the next section, we will connect to SSH and after secure. Remember that if you have a router, you must open port 22 if you want to connect remotely.
Configuring SSH
To configure SSH, we will use nano to edit the configuration file.
To edit the file, type this command in the terminal as a root user
Code:
Code:
sudo nano / etc / ssh / sshd_config
Here, we use the nano text editor (nothing prevents you from using another editor text.)
Here are some interesting sections of the configuration you can change:
Code:
Code:
# What ports, IPs and protocols we listen for Port 22
This section allows you to configure the listening port of the server. For a security issue, you can change this option because it will hurt a bit to hackers.
Code:
Code:
# Use options to restrict contention Which interfaces / protocols sshd bind to # Will ListenAddress:: # ListenAddress 0.0.0.0
This section allows to tell the server to listen only on certain IP addresses. To do this, remove the # and the second ListenAdress replace 0.0.0.0 with your IP address.
Code:
Code:
# Authentication: yes PermitRootLogin LoginGraceTime 120
This section allows you to configure authentication. Option LoginGraceTime is the maximum waiting time after connecting to SSH for identification. The time in seconds.
PermitRootLogin can say whether or not authorized SSH connection to the root account. For safety, it is recommended that you set this option to No. This is important options for this server. You can change all other options to your liking if you want.
To restart the server, just issue the following in the terminal as a root user
Code:
Code:
sudo / etc / init.d / ssh restart
Explanation
Code:
Code:
/ etc / init.d / ssh
This is the program that lets you start, stop or restart SSH.
Code:
This tells the program to restart SSH.
Bookmarks