Search For:
- Home
- Search For:
This article covers how to install and Enable SSH service on Ubuntu 18.04 system. You can now login remotely to your server using any SSH client from Linux or Windows system. To increase security of SSH connection by Changing default SSH port to custom one on you system. Get more details about SSH server from official SSH site.
When establishing a remote connection between a client and a server, a primary concern is ensuring security. For Linux users, the best practice of accessing and managing your server remotely is through the cryptographic protocol known as Secure Shell (SSH).
How to Enable SSH on Ubuntu ?
1. To install SSH, first update the package repository cache with:
$ sudo apt-get update
2. Now install the OpenSSH software package by entering:
$ sudo apt-get install openssh-server
If prompted, type in your password and press y (yes) to permit the installation.
3. To verify the installation was successful and SSH is running use the command:
$ sudo service ssh status
The confirmation message that you are looking for is: Active: active (running).
This article covers how to change the hostname on CentOS 7 using different methods. By default, your server is started with the server's given name as the hostname. Some software such as cPanel requires a valid fully qualified domain name (FQDN) for the hostname to be used during their licensing verification system.
To Change a server's hostname:
1. Using a text editor, open the server's /etc/sysconfig/network file. The following example shows how to open this file in the GNU nano text editor:
# sudo nano /etc/sysconfig/network
2. Modify the HOSTNAME= value to match your FQDN hostname, as shown in the following example:
HOSTNAME=myserver.domain.com
3. Open the file at /etc/hosts. To update the information for internal networking, change the host that is associated with the main IP address for your server, as shown in the following example:
127.0.0.1 localhost localhost.localdomain
123.45.67.89 hostname.domain.com hostname
4. Run the hostname command. This command enables you to change the hostname on the server that the command line remembers, but it does not actively update all of the programs that are running under the old hostname. The following code provides an example:
# hostnamectl set-hostname hostname.domain.com
# hostname
hostname.domain.com
#
5. Use the following command to restart networking on your server to ensure that changes persist on restart:
# /etc/init.d/network restart
This article covers how to change SSH port on your Linux system. SSH (Secure shell) is a cryptographic network protocol used to connect to a remote server securely and it transfer the data in encrypted form between the host and the client.
The default TCP port for SSH is 22, and by changing this default port to the other, it can prevent automated bots and malicious users from being brutally forced into the server.
Before changing the default SSH port number, can check the current port with the below command:
# netstat -ntlp | grep ssh
To change the SSH port:
1. Open the main SSH daemon configuration file /etc/ssh/sshd_config:
# vi /etc/ssh/sshd_config
2. Now search line begins with Port 22 and add hashtag (#) in front of that line.
3. Then add a new Port line below with the custom port.
Note: Replace the sample port number with the custom port number that needs to be set.
4. Save and exit.
How to Restart the SSH daemon for the changes to take effect ?
Run the below commands to restart the SSH daemon and verify that the port changed:
# systemctl restart sshd
# netstat -ntlp | grep ssh
This article covers how to create a new SSH key pair and set up an SSH key-based authentication. You can set up same key to multiple remote hosts. Also, you will learn how to disable SSH password authentication. SSH stands for Secure Shell and works as a method to establish remote connections between computers. SSH is usually used to log in and manage a remote server.
SSH key pairs can be used to authenticate a client to a server. The client creates a key pair and then uploads the public key to any remote server it wishes to access. This is placed in a file called authorized_keys within the ~/. ssh directory in the user account's home directory on the remote server.
To Disable Password Authentication:
Disabling password authentication is a security precaution. It prevents brute-force attacks against attempting to log in to the server.
1. Start by logging into the remote server:
$ ssh user@hostname
2. Next, edit the sshd_config file in a text editor of your choice (we are using nano):
$ sudo nano /etc/ssh/sshd_config
3. Find and modify the following lines to look as follows:
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
4. Write the changes, then exit the editor. Restart the SSH service by entering the following:
$ sudo systemctl restart ssh
This article covers how to enable and disable root user account in Ubuntu system. Considered the most privileged account on a Unix system, root can perform any tasks needed for system administration.
Navigating a specific folder, killing any process or deleting a directory, root is so powerful that it has to be managed properly.
In order to change the root password, you have to use the "passwd" and specify the root account:
$ sudo passwd root
After changing your password, the account will be automatically unlocked.
In order to switch to the root account, you can use the well-known "su" command without any arguments (the default account is root):
$ su -
To restart your SSH server for the modifications to be taken into account:
$ sudo systemctl restart sshd
This article covers how to install Git on your Debian server and how to Setting up Git. With versioning tools such as Git, you can track changes, revert to previous stages, and branch to create alternate versions of files and directories.
How to Install Git with Default Packages on Debian?
1. First, use the apt package management tools to update your local package index.
After updating the system, you can download and install Git:
$ sudo apt update
$ sudo apt install git
2. You can confirm that you have installed Git correctly by running the following command:
git --version