SSHD的配置优化
服务端
vim /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
PrintLastLog no
sed -i '/pam_motd.so/ s/^/#/g' /etc/pam.d/sshd
#重启sshd (三条都可
service ssh restart
systemctl restart sshd
/etc/init.d/ssh restart
客户端
ssh -o ServerAliveInterval=60 user@host
修复openssh-server错误
每次执行apt 命令都会提示
Setting up openssh-server (1:8.4p1-5+deb11u1) …
dpkg: error processing package openssh-server (–configure):
installed openssh-server package post-installation script subprocess was killed by signal (Terminated)
rescue-ssh.target is a disabled or a static unit, not starting it.
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
三行命令即可修复
cd /var/lib/dpkg/info
rm openssh*
dpkg --configure -a
dpkg 修复命令
dpkg --remove --force-remove-reinstreq 包名
示例:dpkg --remove --force-remove-reinstreq openssh openssh-server openssh-client
IPTABLES开放所有端口
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
软连接与硬链接
ln -s file file1 制作一个软连接(file1是一个软连接,指向file)
ln file file2 制作一个硬连接(file2是一个硬连接,指向file)
软连接相当于快捷方式,存的是路径;
硬链接则指向文件系统的索引结点(inode),相同的inode值对应磁盘上的同一份文件。
硬连接file2的inode值和原文件file的inode的值相同,
软连接file1的inode的值和原文件file的inode的值不相同,软连接file1相当于在磁盘上新建了一个文件,而这个文件的内容是原文件的路径。
python3改为python
whereis python
rm -rf /usr/bin/python
rm -rf /usr/bin/pip
ln -s /usr/bin/pip3 /usr/bin/pip
ln -s /usr/bin/python3 /usr/bin/python #注意这里的python3改为上面whereis python显示安装的python3版本号
评论区