侧边栏壁纸
博主头像
tian博主等级

吾乃天骄 已上九霄

  • 累计撰写 11 篇文章
  • 累计创建 3 个标签
  • 累计收到 2 条评论
标签搜索

目 录CONTENT

文章目录

Linux教程

tian
2023-01-13 / 0 评论 / 0 点赞 / 89 阅读 / 437 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2023-05-28,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

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版本号
0

评论区