系统环境非特殊指明均为 Debian 10

关闭 ipv6

编辑 /etc/sysctl.conf,插入以下配置:

#全部禁用 ipv6
net.ipv6.conf.all.disable_ipv6 = 1
#默认禁用 ipv6
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
#指定网卡禁用 ipv6
net.ipv6.conf.eth0.disable_ipv6 = 1

Tips:可执行 ifconfig -a 查看全部网卡

保存并退出,执行 sysctl -p 使配置生效。

解决 AWS EC2 无法使用 root 用户登录


本地 config 文件:

Host aws-ec2
    HostName xx.xx.xx.xx
    User root
    Port 22
    IdentityFile ~/.ssh/aws.cer


正常情况下,当我们新建一台 EC2 实例后,ssh 连接服务器的时候,AWS 是不允许直接使用 root 用户登录的,此时,Terminal 会打印下面的信息:

$ ssh aws-ec2
Please login as the user "admin" rather than the user "root".

Connection to xx.xx.xx.xx closed.

此时,先将用户更改成 admin 连接上服务器后切换到 root 用户并查看 /root/.ssh/authorized_keys

$ sudo su - && cat /root/.ssh/authorized_keys
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"admin\" rather than the user \"root\".';echo;sleep 10" ssh-rsa ... aws-ec2

删除 ssh-rsa 公钥起始配置前的 no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"admin\" rather than the user \"root\".';echo;sleep 10" 即可,此时可以直接使用 root 用户登录。

更改 Docker 镜像及绑定 IP

修改 /etc/docker/daemon.json 文件(不存在手动创建即可),插入以下内容:

{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com"
  ],
  "bip":"192.168.0.1/24"
}

之后重启 Docker 服务:systemctl restart docker.service

Last modification:May 29, 2022
If you think my article is useful to you, please feel free to appreciate