×


Linux Resources


Change the SSH Port on Ubuntu 20.04 Linux Server

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


Configure SSH Keys on Debian 9 System - How to do it ?

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


Enable and Disable Root User Account on Ubuntu 20.04 - Do it Now ?

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


Install Git on Debian 9 System - Step by Step Process ?

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


Install Iptables on CentOS 7 Server - Step by Step Process ?

This article covers how to disable FirewallD and install and iptables on CentOS 7 server. The iptables service stores configuration in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables , while firewalld stores it in various XML files in /usr/lib/firewalld/ and /etc/firewalld/ . 

Note that the /etc/sysconfig/iptables file does not exist as firewalld is installed by default on Red Hat Enterprise Linux.

FirewallD is a complete firewall solution that can be controlled with a command-line utility called firewall-cmd. If you are more comfortable with the Iptables command line syntax, then you can disable FirewallD and go back to the classic iptables setup.


To Install and Use Iptables Linux Firewall:

1. Connect to your server via SSH.

2. Execute the following command one by one: 

$ sudo apt-get update 
$ sudo apt-get install iptables

3. Check the status of your current iptables configuration by running:

$ sudo iptables -L -v


Location of iptables rules on CentOS ?

CentOS 7 uses FirewallD by default. If you would like to manage iptables/ip6tables rules directly without using FirewallD, you may use the old good iptables-services service which will load the iptables/ip6tables rules saved in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables when it is started during boot time.


Configure Firewall with FirewallD on CentOS 7

This article covers how to configure and manage the FirewallD service on your CentOS system. A Linux firewall used to protect your workstation or server from unwanted traffic. You can set up rules to either block traffic or allow through. You can add or delete or update firewall rules without restarting the firewall daemon or service. The firewall-cmd act as a frontend for the nftables. In CentOS 8 nftables replaces iptables as the default Linux network packet filtering framework. 


To Start and enable firewalld, run the commands:

$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld

To Stop and disable firewalld, run the commands:

$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld

To Check the firewalld status, run the command:

$ sudo firewall-cmd --state

To Command to reload a firewalld configuration when you make change to rules, run the command:

$ sudo firewall-cmd --reload

To Get the status of the firewalld service, run the command:

$ sudo systemctl status firewalld

Search by typing a one letter Word Term Here