先贴命令
cat >> /etc/ssh/sshd_config << 'EOF'
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
EOF
cat我知道是查看文件的意思,可是这条>> 和 << 是什么意思呢,求教
还有一句:
/bin/sed -i 's/#Banner/Banner/' /etc/ssh/sshd_config
求解命令
第一条命令:
cat >> /etc/ssh/sshd_config << 'EOF'
>> filename
:标准输出重定向,在此处意思是将标准输出重定向到写入到后面的filename
(默认是直接输出到终端),和>
不同的是,会seed
到文件结束位置,再写入,相当于append
文件。<< token inputs
:标准输入重定向,意思加后面的inputs
重定向为标准输入,直到匹配到token
结束。第二条命令:
/bin/sed -i 's/#Banner/Banner/' /etc/ssh/sshd_config
sed -i 's/search/replace' file
:在文件file
,搜索到search
替换为replace
。