当前位置:网站首页>SSH Remote Control and access
SSH Remote Control and access
2022-07-19 02:47:00 【For whom do the stars change】
1、SSH Server configuration
(1)SSH Service description
Default port :22
Master profile :/etc/ssh/sshd_config
service name :sshd
Check the port :netstat -anpt | grep sshd
restart ssh service :systemctl restart sshd ( After changing the main configuration file, be sure to restart !)
ssh The service is on by default
Change the port number to 2345, Disable reverse parsing , Ban root User and empty password user login .
vim /etc/ssh/sshd_config
Port 2345 ( Modify the listening port to 2345)
UseDNS no ( Ban DNS Reverse DNS )
PermitRootLogin no ( Ban root User remote login )
PermitEmptyPasswords no ( Disable blank password login )
ListenAddress 172.16.16.22 ( The monitoring address is 172 .16.16.22)
Protocol 2 ( Use SSH V2 agreement )
Only zhangsan user ,lisi User remote login ,lisi Users can only use 1.20 Client remote login
vim /etc/ssh/sshd_config
( add to )
AllowUsers zs [email protected] Only refuse zs user ,ls User remote login , Refuse 1.20 Client login
vim /etc/ssh/sshd_config
( add to )
DenyUsers zs [email protected] restart ssh service
systemctl restart sshd
2、Linux Client remote login download and upload
(1) Separate use zs,ls,root Verify whether the user can log in remotely .
ssh -p 2345 [email protected] ( Default port number 22 Don't have to -p)
ssh -p 2345 [email protected]
ssh -p 2345 [email protected](2) Use scp Command in 1.10 Download a file from , take 1.20 Upload your files to 1.10 On . The files are all in /tmp Next
Use touch Command create file
scp -P 2345 [email protected]:/tmp/222.txt /tmp/ ( On the server /tmp/222.txt Download to local directory /tmp in )
scp -P 2345 /tmp/333.txt [email protected]:/tmp/ ( take /tmp/333.txt Upload the file to the server /tmp Directory )3、Windows Client client remote login download and upload
Use xshell Remote login
(1) Verify use zs user xshell Remote login 1.10 The server

(2) Use rz Command to upload a file to the server /usr/src Next . Use sz Command to download a file from the server
download :
Switching users : su root
sz / route / file name ( Download the file )

Upload :
Switching users : su root
Entry directory :cd /usr/src
rz ( Upload files )
4、 Key pair login
stay 1.20 Of linux Client create user tom, And log in to the system
useradd tom ( New client tom user )
passwd tom ( modify tom User password )
su tom ( Client switching tom user )
Generate key pair
ssh-keygen -t ecdsa ( Client generation tom The public and private keys of )
The first tip : Enter enter enter
Second and third tips : Enter the key phrase twice ( Greater than 4 digit , It's the same twice )
Upload the public key to the server zs user .
ssh-copy-id -p 2345 -i ~/.ssh/id_ecdsa.pub [email protected]Verify whether there is a public key file
ll -a /home/zs/.ssh/ ( stay ssh Operation on the server )Verify key pair login
ssh -p 2345 [email protected]
Tips : Enter the key phrase
After successful verification
exit sign out
5、TCP wrapper Protect
stay ssh Server setting policy ,sshd The service only allows 192.168.1.20 and 192.168.3.0 Segment login , Other network segments are not allowed to log in .
vim /etc/hosts.allow ( Permitted Services )
vim /etc/hosts.deny ( Rejected Services )
vim /etc/hosts.allow
add to
sshd:192.168.1.20,192.168.3.
vim /etc/hosts.deny
add to
sshd:ALL Verify with the client
Linux client
ssh -p 2345 [email protected]92.168.1.10Windows Client authentication
Use Xshell authentication
边栏推荐
- Dynamic programming - 01 knapsack problem
- The JMeter BeanShell implementation writes the parameterized data generated by the request to the file
- Common English business mail phrases
- 2022 latest software testing tools
- MySQL数据库安装
- [unity Editor Extension] displays the memory size of all files in the resource directory
- PowerStor500T报错0x01806803
- This article only commemorates the modulus of negative numbers
- Uniapp wechat applet login (authorize wechat first and then mobile phone number) - (1)
- MySQL初探
猜你喜欢
![[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti](/img/a8/2daa2c0d834f1986c8421bf5138c7e.png)
[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti

shell脚本接收和返回参数

Use JMeter to test services based on websocket protocol

Leetcode --- one question per day

学习网络基础

The difference between cookies and sessions

HCIA_NAT实验

NAT综合实验

Subnet division (see details)

How to add software shortcuts to the right mouse button list
随机推荐
How to use nmon
Sword finger offer 48 The longest substring without repeated characters
shell脚本接收和返回参数
Post man JSON script to JMX script of JMeter
Known preorder traversal, preorder traversal, find the sequence traversal of the tree
Flask template injection
module_init函数底层原理
Bladex - a well-designed microservice architecture
Shell programming specifications and variables
[solution] the local Group Policy Editor (gpedit.msc) in Win 11 cannot be opened
Traversal of binary tree
Image quality evaluation indicators: SNR, PSNR, MSE and SSIM
Various development tools
Flyway的SaaS多租户实现方案
For solopi app performance test
How to add software shortcuts to the right mouse button list
Shell编程规范与变量
NFS服务
HCIA第一次静态路由实验
InnoDB, MySQL structure, and the difference between the three kinds of deletion