当前位置:网站首页>ssh的复习
ssh的复习
2022-06-25 22:11:00 【XUPT-BDAL-LAB-ML&OP】
介绍
SSH(Secure Shell)是一种能够以安全的方式提供远程登录的协议,也是目前远程管理Linux系统的首选方式。在此之前,一般使用FTP或Telnet来进行远程登录。但是因为它们以明文的形式在网络中传输账户密码和数据信息,因此很不安全,很容易受到黑客发起的中间人攻击,轻则篡改传输的数据信息,重则直接抓取服务器的账户密码。
想要使用SSH协议来远程管理Linux系统,则需要配置部署sshd服务程序。sshd是基于SSH协议开发的一款远程管理服务程序,不仅使用起来方便快捷,而且能够提供两种安全验证的方法:
基于密码的验证—用账户和密码来验证登录;
基于密钥的验证—需要在本地生成密钥对,然后把密钥对中的公钥上传至服务器,并与服务器中的公钥进行比较;该方式相较来说更安全。
ssh-keygen
在客户端主机中生成“密钥对”,记住是客户端。
ssh-copy-id
把客户端主机中生成的公钥文件传送至远程服务器。
scp
参数 作用
-v 显示详细的连接进度
-P 指定远程主机的sshd端口号
-r 用于传送文件夹
-6 使用IPv6协议
配置文件作用
Port 22 默认的sshd服务端口
ListenAddress 0.0.0.0 设定sshd服务器监听的IP地址
Protocol 2 SSH协议的版本号
HostKey /tc/ssh/ssh_host_key SSH协议版本为1时,DES私钥存放的位置
HostKey /etc/ssh/ssh_host_rsa_key SSH协议版本为2时,RSA私钥存放的位置
HostKey /etc/ssh/ssh_host_dsa_key SSH协议版本为2时,DSA私钥存放的位置
PermitRootLogin yes 设定是否允许root管理员直接登录
StrictModes yes 当远程用户的私钥改变时直接拒绝连接
MaxAuthTries 6 最大密码尝试次数
MaxSessions 10 最大终端数
PasswordAuthentication yes 是否允许密码验证
PermitEmptyPasswords no 是否允许空密码登录(很不安全)
/etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# This system is following system-wide crypto policy. The changes to
# crypto properties (Ciphers, MACs, ...) will not have any effect here.
# They will be overridden by command-line options passed to the server
# on command line.
# Please, check manual pages for update-crypto-policies(8) and sshd_config(5).
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes
# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
#GSSAPIEnablek5users no
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# and ChallengeResponseAuthentication to 'no'.
# WARNING: 'UsePAM no' is not supported in Fedora and may cause several
# problems.
UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
# It is recommended to use pam_motd in /etc/pam.d/sshd instead of PrintMotd,
# as it is more configurable and versatile than the built-in version.
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
UseDNS no
AddressFamily inet
SyslogFacility AUTHPRIV
PermitRootLogin yes
PasswordAuthentication yes
面试题
1、Windows和LINUX常用的远程连接工具有那些
xshell、serureCRT
边栏推荐
- JS中的数字数组去重
- PHP interprocess pass file descriptor
- SSM integrated learning notes (mainly ideas)
- MySQL InnoDB lock knowledge points
- postman如何测试需要登录的接口
- SSL/TLS、对称加密和非对称加密和TLSv1.3
- 用ES5的方式实现const
- Run the dronekit flight control application on Shumei faction under px4-jmavsim software simulation environment
- Establishment of multiple background blocks in botu software_ Old bear passing by_ Sina blog
- P3052 [USACO12MAR]Cows in a Skyscraper G
猜你喜欢

line-height小用

Line height for small use

如何设计产品的roadmap?

7.常用指令(下)v-on,v-bind,v-model的常见操作

DPVS-FullNAT模式管理篇

One article explains R & D efficiency! Your concerns are

MySQL version upgrade + data migration

postman如何测试需要登录的接口

final和static

Simulation connection between WinCC and STEP7_ Old bear passing by_ Sina blog
随机推荐
如何设计产品的roadmap?
Problems encountered in Doris operation and maintenance
6.常用指令(上)v-cloak,v-once,v-pre
Apache Doris1.0版本集群搭建、负载均衡与参数调优
(转载)进程和线程的形象解释
剑指 Offer 48. 最长不含重复字符的子字符串
利用VBScript连接mysql数据库_过路老熊_新浪博客
Oracle writes a trigger that inserts a piece of data first and updates a field in the data
支付宝支付接口沙箱环境测试以及整合到一个ssm电商项目中
STEP7 master station and remote i/o networking_ Old bear passing by_ Sina blog
Find the minimum value of flipped array [Abstract bisection]
我的博客今天2岁167天了,我领取了先锋博主徽章_过路老熊_新浪博客
One article explains R & D efficiency! Your concerns are
mysql5.7版本在配置文件my.ini[mysqld]加上skip-grant-tables后无法启动
Megacli常用命令整理
Mutual conversion of float type data and datetime type data in sqlserver2008
Object array de duplication
c_ uart_ interface_ Example and offboard modes
static关键字详解
文献调研(四):基于case-based reasoning、ANN、PCA的建筑小时用电量预测