动执行切割日志文件命令
split -d -b 10M 要被切割的日志 切割以后文件前缀
一面火,一面冰.繁与简的完美结合,杂而不乱,一切本应就是井然有序
SSH(Secure Shell)是一个提供数据通信安全、远程登录、远程指令执行等功能的安全网络协议。ssh用于加密两台计算机之间的通信,并且支持各种身份验证机制。最初提出目的是替代非安全的Telnet、rsh、rexec等远程Shell协议。之后SSH发展了两个大版本SSH-1和SSH-2。
OpenSSH 的客户端是二进制程序 ssh,Linux 系统一般都自带 ssh。新版的win10开启ssh服务,但不是很好用,可以使用一些好用的软件Xshell、Putty等
安装OpenSSH 以后,可以使用-V参数输出版本号,查看一下是否安装成功。
ssh -V
一、多个ssh公钥场景
前面说了利用密钥ssh可以快速登录,而不用每次都输入密码。
有时候在github和gitee中我们想用不同的密钥登录,或者某个服务器我们想使用另外一个公钥登录。这就情况下我们就需要配置多个公钥。
二、密钥登录流程
我们在生成私钥和公钥的默认的名称是id_rsa。前面已经详细说过密钥登录流程了,而密钥登录的时候会默认读取id_rsa密钥进行验证。因此,我们在使用多个密钥对的时候,必须告诉ssh哪个服务器验证用哪个密钥。
在一台电脑上生成多个公钥格式ssh-keygen -t rsa -C 邮箱 公钥名,详细参数上一节已经说过了。
/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
SyslogFacility AUTHPRIV
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
RSAAuthentication yes
#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!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication no
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication yes
# 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
# PasswordAuthentication. Depending on your PAM configuration,
# 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
# PAM authentication, then enable this but set PasswordAuthentication
# 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用来设置sshd是否在用户登录时显示“/etc/motd”中的信息,可以选在在“/etc/motd”中加入警告的信息
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
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1
error: kex_protocol_error: type 30 seq 1 [preauth]
sshd -T | grep kex
serauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms
CentOS Stream 9 / Rocky Linux 9系列系统在OS内部的crypto-policies策略默认为DEFAULT,在该策略模式下openssh-server禁用了ssh-rsa(rsa/SHA1)签名算法。
由于FinalShell、nuoshell等部分SSH客户端软件默认仅支持使用ssh-rsa(rsa/SHA1)签名算法,不能兼容使用rsa-sha2-256(rsa/SHA256)或者rsa-sha2-512(rsa/SHA512),所以无法登录。
您可以通过update-crypto-policies --show命令查看当前系统的策略。
如果不想换成更安全的登录方式,则可以简单粗暴的打开ssh-rsa算法支持.
运行以下命令,切换策略为LEGACY。
当MySQL数据库中的表数据过大时,直接导出整个表可能会消耗大量内存和CPU资源,甚至导致服务器性能下降
mysqldump --column-statistics=0 -h远程地址 -P端口号 -u用户名 -p密码 数据库名称 表名称 --where="id >= 2324373" --set-gtid-purged=off > 文件名.sql