ubuntu20.04启用root账户

By | 2023-10-11

启用root账户开启密码登陆用到的命令:
sudo passwd root
修改密码

编辑配置文件:
vim /etc/ssh/sshd_config
修改参数:
找到PermitRootLogin, 把前面的#去掉 改成下面这样
PermitRootLogin yes

修改参数:
PasswordAuthentication no改为yes

:wq保存退出

reboot
重启服务器。就可以使用root用户名配合秘钥登入了
或者sudo systemctl restart sshd

y一键安装docker
bash <(curl -sSL "https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh")

安装docker
sudo apt-get update
sudo apt-get upgrade
添加使用 HTTPS 传输的软件包以及 CA 证书
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
官方密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
添加官方源
echo \ # "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ # $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get install docker.io

$ sudo systemctl enable docker
$ sudo systemctl start docker

修改namesever为8.8.8.8
vim /run/systemd/resolve/stub-resolv.conf
需更新一下resolvconf的配置,方法是执行
resolvconf -u
vim /etc/resolv.conf