2019-05-21 遇到的一点小问题
公司的测试设备版本是Linux archlinux 4.19.31-rt18-1-ARCH
,不过很多功能都去掉了。比如ssh功能就没有,测试很不方便。安装后,每次更新又会没掉,所以这边记录一下,方便查询。
首先pacman -Sy openssh
安装openssh,然后systemctl start sshd
开启sshd服务。
C:\Users\wannoo>ssh root@192.168.10.250
ssh: connect to host 192.168.10.250 port 22: Connection refused
C:\Users\wannoo>ssh root@192.168.10.250
The authenticity of host '192.168.10.250 (192.168.10.250)' can't be established.
ECDSA key fingerprint is SHA256:gt/ieUVNhwkw+JCt3MaBd1XDOx/M27ZW+R/u9l5QD50.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.250' (ECDSA) to the list of known hosts.
不过这个时候使用FinalShell尝试连接会一直让输入密码;换成Windows的cmd命令行尝试连接,会一直提示Permission denied, please try again.
,即使你的密码没错,也会这样提示。
C:\Users\wannoo>ssh root@192.168.10.250
root@192.168.10.250's password:
Permission denied, please try again.
root@192.168.10.250's password:
Permission denied, please try again.
root@192.168.10.250's password:
网上查了下,才知道要配置/etc/ssh/sshd_config
文件。还有原本的PermitRootLogin语句是注释起来的#PermitRootLogin prohibit-password
,所以很省事,不用再安装vi工具,只需用echo语句在最后面追加PermitRootLogin yes
。然后再systemctl restart sshd
重启sshd服务就可以了。
C:\Users\wannoo>ssh root@192.168.10.250
root@192.168.10.250's password:
Last login: Mon Jun 3 01:22:52 2019 from 192.168.10.41
[root@archlinux ~]# whoami
root
这边记一下完整的,主要就这几句:
pacman -Sy openssh #安装
echo "PermitRootLogin yes" >> "/etc/ssh/sshd_config" #修改配置表
systemctl start sshd #开启
systemctl enable sshd #开机启动
2019-07-03 遇到的一点小问题
ssh root@192.168.10.141
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:hnEtidFv1hmWrtg6hjtv6HkPEFEIEYk7VG76fn0pVnE.
Please contact your system administrator.
Add correct host key in C:\\Users\\wannoo/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\wannoo/.ssh/known_hosts:1
ECDSA host key for 192.168.10.250 has changed and you have requested strict checking.
Host key verification failed.
C:\Users\wannoo.ssh\known_hosts
192.168.10.250 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGoUL5O5Y8qAlp+KTLHD2kMqwrPBofZmawkhSPuarZ0Niuyr4wYbpQ5PnY264vkLOdT9VjqBkuD5rSIdcDf9HVc=
C:\Users\wannoo>ssh root@192.168.10.250
The authenticity of host '192.168.10.250 (192.168.10.250)' can't be established.
ECDSA key fingerprint is SHA256:hnEtidFv1hmWrtg6hjtv6HkPEFEIEYk7VG76fn0pVnE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.250' (ECDSA) to the list of known hosts.
root@192.168.10.250's password:
Permission denied, please try again.
root@192.168.10.250's password:
2019-11-12 遇到的一点小问题
今天在修改配置表时,语句echo "PermitRootLogin yes" >> "/etc/ssh/sshd_config
打错,多了个单词,结果sshd无法启动。因为没有安装vi,所以使用命令sed -i 's/原字符串/新字符串/g' /etc/ssh/sshd_config
进行修改。
记录一下。
.
2019-05-29
sshd 中文手册 [金步国]
sed修炼系列- 骏马金龙 - 博客园
awk知识点总结- 骏马金龙 - 博客园
echo "${disk}"| awk '{print $(NF-2)}' #倒数第2列
2019-06-10
shell中for循环,读取一整行
Shell中的IFS解惑
2019-06-13
Arch manual pages
Linux和Shell回炉复习系列文章总目录
金步国作品集