WhileNetworking

  • Home
  • CCNA
  • Cisco Packet Tracer Download
    • Cisco packet tracer 6.3
    • cisco packet tracer 6.2
    • Cisco Packet Tracer 7
  • Linux Server Management
  • About Us
  • Privacy Policy
  • Contact Us

SSH configure in Linux (CentOS/Red Hat)

You are most welcome to this post.
IPv6 Bridge and bonding in Linux (CentOS/Red Hat)
Really thanks to you for your interest in this topics. :)

Hello all, hope that you are well. Lets see, what is in todays post. To I’m going to show you how to configure  SSH. SSH generally stands for Secure Shell.

SSH configure in Linux (CentOS/Red Hat)

It is a application which is generally used in the work of remote admintration of any server, router, firewalld etc. Generally it uses a port no. by default it uses the 22 port no. You can change the port no according to your network design. As you know, you need a installed package for this service. Generally for SERVER a package named openssh-server need to be installed. And for client it needs a client package named openssh-client.  The Daemon is sshd. Generally the configure file found the “/etc/ssh/sshd_config”.

So we’ve learn something, now lets goto the step by step configuration:

Lets change the Host Name:

[root@localhost ~]# echo ssh-serverX.example.com > /etc/hostname
[root@localhost ~]# logout
[root@ssh-serverX ~]#

Step 01: Install the RPM Query

[root@ssh-serverX ~]# rpm -qa | grep openssh-server
openssh-server-6.4p1-8.el7.x86_64

[root@ssh-serverX ~]# yum install openssh* -y  [if not found] [root@ssh-serverX ~]# systemctl restart sshd.service
[root@ssh-serverX ~]# systemctl enable sshd.service
[root@ssh-serverX ~]# systemctl status sshd.service

[root@ssh-serverX ~]# ifconfig

(Optional): Temporary IP Configure:
———————————-
ifconfig eth0 172.25.11.200+X netmask 255.255.255.0

Now need to install the SSH Client:
Generally in the case of Linux, the client is installed previously.
But in the windows, you need to install manually. Different types of client is for windows. In this we’ve chosen putty. Putty is a popular client in windows platform.

Now lets test:
Move to Desktop

> ping 192.168.2.2+X   (ssh server)

SSH Login with Root User

[root@desktopX ~]# ssh root@192.168.2.2+X

Are you sure you want to continue connecting (yes/no)? yes
root@192.168.2.2+X’s password: ****** (remote PC)

[root@ssh-serverX ~]# who
[root@ssh-serverX ~]# useradd user1
[root@ssh-serverX ~]# passwd user1
: 123
: 123

[root@ssh-serverX ~]# exit

Linux with user1:

[root@desktopX ~]# ssh root@192.168.2.2+X hostname

[root@desktopX ~]# ssh  user1@192.168.2.2+X

[user1@serverX~]$ su –
: ********

[root@ssh-serverX ~]# who
[root@ssh-serverX ~]# exit
[root@desktopX ~]#

Now we’ll use the Secure Copy using “scp” command from server:

[root@desktopX ~]# scp root@172.25.11.200+X:/etc/passwd /root/Desktop

Secure Copy (scp) to serverX:

[root@desktopX ~]# scp /etc/passwd root@172.25.11.200+X:/root

Password Less ssh login:

[root@desktopX ~]# cd
[root@desktopX ~]# ls
[root@desktopX ~]# ls -la
[root@desktopX ~]# cd .ssh
[root@desktopX .ssh]# ls
known_host (list of known hosts)  id_rsa.pub   id_rsa

[root@desktopX .ssh]# rm -rf *

[root@desktopX .ssh]# ls
[root@desktopX .ssh]# ssh user1@172.25.11.200+X

Are you sure you want to continue connecting (yes/no)? yes

press Ctlrl+C

[root@desktopX .ssh]# ls
known_host (created)

[root@desktopX .ssh]# ssh-keygen  ; (Enter 3 Times)
id_rsa.pub id_rsa

[root@desktopX .ssh]# cat id_rsa
[root@desktopX .ssh]# cat id_rsa.pub

[root@desktopX .ssh]# ssh-copy-id user1@172.25.11.200+X  (serverX)
[root@desktopX .ssh]# ssh user1@172.25.11.200+X

[user1@ssh-serverX ~]$ cd .ssh
[user1@ssh-serverX .ssh]$ ls
authorized_keys

[user1@serverX .ssh]$ cat authorized_keys   ; same as public key of desktopX

Now we’ll move to serverX (Virtually)

As you know, and we previously said that our default port is portt no 22. According to our need we can change default port:

[root@deX ~]# netstat -ntlp | grep ssh

[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu

17 #Port 22         ; old
17  Port 2015       ; remove ‘#’

[root@serverX ~]# systemctl restart sshd.service
[root@serverX ~]# setenforce 0
[root@serverX ~]# systemctl stop firewalld
[root@serverX ~]# systemctl disable firewalld

Now we’ll verify curren SSH port:

[root@serverX ~]# netstat -ntlp | grep ssh

Now lets move to desktopX (Physically)

Now we’ll try SSH Server Login with Specif Port:

[root@desktopX ~]# ssh user1@192.168.2.2+X   (default port)  – Refused

[root@desktopX ~]# ssh -p  2015  user1@172.25.11.200+X    ; if user1 user

[user1@serverX ~]$ exit

Now if you want, and if you are a server admin, you can disable root login.

[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu

48 #PermitRootLogin yes        ;old
48  PermitRootLogin no         ;new

[root@serverX ~]# systemctl restart sshd.service

Now test the system:

[root@desktopX ~]# ssh -p 2015 root@192.168.2.2+X

[root@desktopX ~]# ssh -p 2015 user1@192.168.2.2+X

Hope that it is working. Also you’ve enjoyed.
Waiting for your comments.
🙂

Jun 10, 2016Himadri
 

Share with friends :

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to email a link to a friend (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to print (Opens in new window)

Related

IPv6 bridge and bonding in Linux (CentOS/Red Hat)Firewall configuration in Linux (CentOS/Red Hat)

Leave a Reply Cancel reply

thirteen − 9 =

Himadri

Hi, I'm Himadri. I love blogging with tech topics, specially computer networking. We'll have more fun in the upcoming day. Stay with me. :)

June 10, 2016 Linux installation and server managementSSH configure, SSH configure in CentOS, SSH configure in Linux, SSH configure in Red Hat265
Feel Free to Share :)
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Find Us on Facebook
Choose a category !!
  • CCNA
  • Cisco Certification Exam
  • cisco packet tracer 6.2
  • Cisco packet tracer 6.3
  • Cisco Packet Tracer 7
  • Cisco Packet Tracer 7.1
  • Cisco Packet Tracer 7.2.1
  • Cisco Packet Tracer 7.3
  • Cyber Security
  • Engineering Ebooks
  • Excel
  • IELTS Ebook
  • Internet
  • Know computer
  • Know your computer
  • Laser Processing of Material
  • Linux installation and server management
  • PDF
  • Technology
  • Uncategorized
Top posts
  • Free download Cisco Packet Tracer 7 for linux (64 bit)
  • Packet tracer 6.2 student version for Linux - Free download
  • Free download Principles of Electronics by VK Mehta
Archieves
Get latest updates by Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 19 other subscribers
W
SC
wordpress counter
Analytics
Recent Comments
    Browse by categories
    Cyber SecurityLinux installation and server managementCCNAKnow your computerKnow computerCisco Packet Tracer 7UncategorizedCisco Certification ExamInternetPDFCisco Packet Tracer 7.3Engineering EbooksCisco packet tracer 6.3cisco packet tracer 6.2Cisco Packet Tracer 7.1TechnologyExcelLaser Processing of MaterialCisco Packet Tracer 7.2.1IELTS Ebook
    Feel free to contact with us

    Hi, any kind of comment or suggestion is valuable to us. So feel free to contact with us.

    Email: himadri.shekhar.bd@gmail.com

    Name: WhileNetworking.com

    2021 © WhileNetworking