Install and enable ssh server on Centos 7

- Advertisment -
- Advertisement -

SSH server or client installation on CentOS 7 or 6 is really super easy you need to follow some commands given in the article…

SSH stands for Secure Shell protocol used to remotely log in and access computer system -servers or PC. It was primarily developed to use in the UNIX system but later on, spread to other OSs too. It is developed to securely connect systems by simply bypassing any vulnerability of network or hackers. Systems with SSH server and Client uses a special key to establish a connection. It is a cross-platform tool that can be used on Windows, Linux, FreeBSD, Android or MacOS. Know more about SSH (secure shell protocol).

Here we will show how to install OpenSSH on CentOS 7 to access it remotely from Windows 10/7 OS using Putty.

Install ssh client on CentOS 7/6

On CentOS Desktop or Server, whatever you have, we will install two part of the OpenSSH (an open source SSH tool); one will be OpenSSH client to access other systems using SSH and another one is OpenSSH server to run an SSH server daemon so that you can access your CentOS remotely.

sudo yum -y install openssh-server openssh-clients

Enable SSH as System services

If every time you don’t want to run SSH service on CentOS manually than simply we have to enable SSH as Systemctl service (system services). It means the moment your system get booted, it will automatically enable and run.

chkconfig sshd on

Start CentOS SSH service

Simply use the below command to finally start sshd daemon (openssh-server)

service sshd start

To Stop

In case you want to stop SSH server on CentOS:

sudo service sshd stop

To Disable service (optional)

Use command to disable SSH service on and then delete it, so that it can’t up and run with system boot up

sudo chkconfig sshd off

Remove it

sudo chkconfig sshd --del

Uninstall OpenSSH server

In future, when you don’t need it anymore, use the below command for uninstalling SSH server from CetnOS

yum remove openssh



Finally, your system has the SSH, now let’s say you want to connect CentOS 7 from Windows 10 using PuTTY.

  • First, download and Install Putty on Windows 10
  • Run PuTTY
  • Enter the IP address of CentOS running with OpenSSH server. If you don’t know the IP address of your CentOS server or Desktop then simply run a command ifconfig in Terminal.
  • Select SSH as a connection type
  • Finally, click on the Open button.

Putty configuration to connect

PuTTY will ask to accept the server generated ssh key by clicking on the YES button.

Putty

A terminal window will open asking you to log in. Now you can log in as root or any other user that present on CetnOS and you want to connect.

Putty SSH screen

OpenSSH Server Configuration (optional)

In case you want to restrict some IP address to SSH, or disable the root access of server or want to change the default 22 port of SSH to some custom one, then simply edit the shd_config file of OpenSSH server on CertnOS.

From Terminal use VIM to edit the configuration file:

 vi /etc/ssh/sshd_config

In the file, find and replace:

To bind some IP address to SSH, first, remove the # from ListenAddress and replace 0.0.0.0 with the IP address.

To change the Port 22 to some other, then again remove # given in the front of Port 22 and replace 22 with a port number you want to assign.

edit ssh server centos configuration file

To disable the root login, remove # and replace yes with no given in front of PermitRootLogin option.

PermitRootLogin no

disable root login in ssh server centos 7

To restrict login to some User, then add the following

AllowUsers users

Replace users with your username.

After performing all the changes save the file, for that first press ESC button and then type :wq

Finally, restart the SSH service.

service sshd restart

Other Resources:

 

Rajkumar Mauryahttps://www.how2shout.com
Rajkumar Maurya is the H2S Media tech expert. He’s always been passionate about technology and has been writing on the subject since 2014. He has extensive knowledge of all kinds of technology, from consumer-tech to enterprise solutions. You can contact the author at-- raj@how2shout.com

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

How to run Chrome extensions on Microsoft Edge Chromium browser

It is long since we know about Microsoft Edge, which is Microsoft's endeavour to dominate the market of browsers....

How to get dark mode on WhatsApp to keep eyes stress free

WhatsApp keeps adding new features to the app, and most features turn out to be useful for us, except...

73% of software developers willing to invest Rs 10-20k per year for upskilling

The rapid development in the technology area is compelling the firms and developers to gear up their technology skills...

Sony accidentally confirmed a massive News leak on PS5

The PlayStation 5 launch is just around the corner. Also, the rumours are about an upcoming meeting of Sony...
- Advertisement -

Horizon: Zero Dawn is Coming to PC, all about its release

There is news coming up from the insider sources that Sony is already working on their project to release...

WhatsApp Dark Mode is available for Android users, test it now!

Finally, to save the oil of eye lamps especially for those continuously do chats on WhatsApp, Dark Mode is...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you