RHEL8.0 quick start series notes -- remote connection management service SSH

RHEL8.0 quick start series notes - remote connection management service SSH (12)

1. Understand server and client
Server: provide server
Client: enjoy the server

How do we find the services we want to access through the network?
IP (server providing service) + port (find corresponding service)
2. Understand the setting of port number
Note: the port number is only an integer, ranging from 0 to 65535

  • 1-255: generally well-known ports, such as ftp 21, web 80, ssh 22, telnet 23, etc
  • 256-1023: Unix system is usually used to provide specific services
  • 1024-5000: client temporary port, randomly generated
  • More than 5000: reserved for other services on the Internet

3. Understand the role of ssh services
Security protocol for remote connection to login management server under Linux.
Features: remote management server

  • SSH service default port 22
  • SSH service is a C/S architecture
    Server side (enable ssh service): install software (openssh server)
    Client (special client tool):
    linux: openssh-clients

Check whether power on starts automatically by default

[root@RedHat8 ~]# systemctl list-unit-files | grep sshd.service
anaconda-sshd.service                       static   
sshd.service                                enabled  

4. SSH service restart / stop

[root@RedHat8 ~]# systemctl list-unit-files | grep sshd.service
[root@RedHat8 ~]# systemctl stop sshd.service 
[root@RedHat8 ~]# systemctl start sshd.service 
[root@RedHat8 ~]# systemctl restart sshd.service 
[root@RedHat8 ~]# systemctl enable sshd.service 
[root@RedHat8 ~]# systemctl disable sshd.service 

5. Modify the default port of SSH service
(1) View ssh service port

netstat Commands: for viewing network connection status
-n: Do not display name
-l: View listening status
-t: TCP
-u: UDP
-p: View program name

[root@RedHat8 ~]# netstat -nltp | grep :22
[root@RedHat8 ~]# lsof -i :22
sshd     8054 root    5u  IPv4  53308      0t0  TCP RedHat8.rhel.cn:ssh-> (ESTABLISHED)
sshd     8076 root    5u  IPv4  53308      0t0  TCP RedHat8.rhel.cn:ssh-> (ESTABLISHED)
sshd    48278 root    5u  IPv4 143373      0t0  TCP *:ssh (LISTEN)
sshd    48278 root    7u  IPv6 143375      0t0  TCP *:ssh (LISTEN)

(2) Modify ssh service default port

1.modify/etc/ssh/sshd_config configuration file
[root@RedHat8 ~]# vim /etc/ssh/sshd_config
#Port 22
Port 10022
#AddressFamily any
#ListenAddress ::
2.Restart service
[root@RedHat8 ~]# systemctl restart sshd.service
3.View port
[root@RedHat8 ~]#netstat -nltup | grep :22

(3) Summary
1. Turn off firewall and selinux
2. Configure yum source software warehouse
3. Software Trilogy: install software, confirm whether the software is installed, check the list of software files (configuration file, program itself, man document manual)
4. Understand the configuration file (man 5 xxx.conf)
5. Modify the configuration file according to the requirements of the principality to complete the service construction
6. Start the service and start the machine automatically
7. Test verification
6. Command based on SSH service
(1) ssh: a client tool under Linux

Client: install client software, openssh clients
 Function 1: remote connection of client to linux server (ssh service)
ssh [options] remote IP
 -l: Specify access user
 -p: Specify the port to connect to the server
ssh -p 1002 -l user01
ssh -p 10022 user01@
 Note: the user name must be a remote server-side user, not a client-side user

Function 2: the client accesses the Linux server remotely and executes the corresponding command (not logged in)
ssh [options] user01@ command < hostname >

(2) Remote copy command scp under Linux

Usage 1: remote copy local file to remote (push)
scp [options] local file remote server IP: / path

Usage 2: copy the price inquiry on the remote server to the local (pull)
scp [options] remote server IP: / file local path

Note: whether the path of the local file can be written to the current copy file user
Published 12 original articles, won praise 1, visited 102
Private letter follow

Tags: ssh Linux openssh network

Posted on Thu, 06 Feb 2020 07:25:57 -0500 by dotwebbie