Posted by : Redhat 1 Thursday, January 7, 2016

SSH - Secure Shell       
SSH - Secure Shell
------------------------
Port no: 22 (default)
Package: openssh-server
Daemon: sshd
configuration file: /etc/ssh/sshd_config
Step by step configuration:
==========================
Step 01: RPM Query, install
---------------------------------
[root@serverX ~]# rpm -qa | grep openssh-server
openssh-server-6.4p1-8.el7.x86_64
[root@serverX ~]# yum install openssh* -y [if not found]
[root@serverX ~]# systemctl restart sshd.service
[root@serverX ~]# systemctl enable sshd.service
[root@serverX ~]# systemctl stop firewalld.service
[root@serverX ~]# systemctl disable firewalld.service
[root@serverX ~]# setenforce 0 ;SELinux off
SSH Client:
-----------
=> Linux Client (defautl installed)
=> Windows Client (putty, ssh client)
> putty > ssh > ip > port (22)
Testing:
--------
> ping 192.168.11.Y (ssh server)
SSH Login with Root User
---------------------------------
[root@desktopX ~]# ssh root@192.168.11.Y
Are you sure you want to continue connecting (yes/no)? yes
root@192.168.11.Y's password: ******
[root@serverX ~]# who
[root@serverX ~]# useradd student
[root@serverX ~]# passwd student
: 123
: 123
[root@serverX ~]# exit
Linux with Specific user name:
----------------------------
[root@desktopX ~]# ssh student@192.168.11.Y
[student@serverX~]$ su -
: ********
[root@serverX ~]# who
Secure Copy (scp) from Desktop:
-------------------------------
[root@desktopX ~]# scp root@192.168.11.X:/etc/passwd /root/Desktop
Password Less ssh login:
------------------------
[root@desktopX ~]# ssh-keygen
[root@desktopX ~]# ls -l /root/.ssh
[root@desktopX ~]# ssh-copy-id 192.168.11.X
[root@desktopX ~]# ssh 192.68.11.X
Change Default Port:
-------------------
[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu
17 ‪#‎Port‬ 22 ; old
17 Port 2015 ; new
[root@serverX ~]# systemctl restart sshd.service
Verify curren SSH port:
-----------------------
[root@serverX ~]# netstat -ntlp | grep ssh
SSH Server Login with Specif Port:
---------------------------------
[root@desktopX ~]# ssh -p 2015 student@192.168.11.Y ; if student user
Secure Copy (scp) with port:
----------------------------
[root@desktopX ~]# scp -r -P 2015 root@192.168.11.Y:/etc/ /root/Desktop ; if root user
* here "-r" for directory copy
Secure copy (scp) to Remote server:
-----------------------------------
[root@desktopX ~]# scp -r -P 2015 /etc/shadow 192.168.11.X:/root/
Disabled 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
Test:
----
[root@desktopX ~]# ssh -p 2015 root@192.168.11.Y
[root@desktopX ~]# ssh -p 2015 student@192.168.11.Y

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Popular Post

Facebook Page

- Copyright © Configuretion Redhat -Robotic Notes- Powered by Blogger - Designed by bdnet -