Experiment No:02: Sudo Yum - y Install Openssh-Server Openssh-Clients

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Experiment No:02

Aim: - Installation and Configuration SSH Server (Red hat/CentOS and Ubuntu enable/disable root
login.)
Objectives:
1. Students should able to install SSH server and configure it on Computer System and even on virtual
environment
2. Students should able to Differentiate between secure and unsecure remote system access.
Theory:

sshd (OpenSSH Daemon or server) is the daemon program for ssh client. It is a free and open source
ssh server. ssh replaces insecure rlogin and rsh, and provide secure encrypted communications
between two untrusted hosts over an insecure network such as the Internet.
Installation steps to be followed:
1. Open the terminal application for system.
2. Type sudo apt-get install openssh-server
3. Enable the ssh service by typing sudo systemctl enable ssh
4. Start the ssh service by typing sudo systemctl start ssh
5. Test it by login into the system using ssh user@server-name

Installation steps to be followed:

Step 1: Install OpenSSH Server Software Package


Enter the following command from your terminal to start the installation process:
sudo yum –y install openssh-server openssh-clients
This command installs both the OpenSSH client applications, as well as the OpenSSH
server daemon, sshd.

Step 2: Starting SSH Service


To start the SSH daemon on the OpenSSH server:
sudo systemctl start sshd
When active, sshd continuously listens for client connections from any of the client
tools. When a connection request occurs, sshd sets up the correct connection.
Step 3: Enable OpenSSH Service
Enable SSH to start automatically after each system reboot by using the systemctl command:
sudo systemctl enable sshd
To disable SSH after reboot enter:
sudo systemctl disable sshd
Step 4: OpenSSH Server Configuration
Properly configuring the sshd configuration file hardens server security. The most
common settings to enhance security are changing the port number, disabling root logins,
and limiting access to only certain users.
To edit these settings access the /etc/ssh/sshd_config file:
sudo vim /etc/ssh/sshd_config
Once you access the file by using a text editor (in this example we used vim), you can
disable root logins and edit the default port number:
 To disable root login:
PermitRootLogin no
Steps:
1. In virtual machine setting do following

2. Client setting:
set hostname as client using following command
#hostnamectl set-hostname client

3. Server setting
set hostname as server using following command
#hostnamectl set-hostname server

4. Make entry inside /etc/hosts file for available machines in the network with their ip address and
hostname. As follows:
Open that file with vim editor i.e vim /etc/hosts
5. After completion of this reload the system daemon services. Using following command on both the
machines.
#systemctl daemon-reload
6. Now go to client machine and connect to server machine using ssh.
#ssh root@server
(you will be prompted to server machines shell )
Create any file in server machine using ssh and cross check it actual machine.
7. Now go to server machine and connect to client machine using ssh.
#ssh root@client
(you will be prompted to client machines shell )
Create any file in client machine using ssh and cross check it actual machine.

CONCLUSIONS:

In this Practical we learned how to enable SSH on a Linux server. Additionally, we configured SSH
rules to limit access.

You might also like