docker pull的CentOS的镜像的root密码是多少?怎么改密码?怎么登入ssh?

发布时间:2021年05月12日 阅读:541 次

.docker run -it centos:latest /bin/bash 运行该容器,

并进入容器内部,默认是root用户;

安装passwd软件;

yum install passwd

修改root用户密码执行passwd命令,

passwd

一般很少会想到centos镜像中passwd可执行文件都没有。

 

1. 安装openssh-server

yum install -y openssl openssh-server

2. 修改配置文件

用vim打开配置文件/etc/ssh/sshd_config

将上图的PermitRootLogin,RSAAuthentication,PubkeyAuthentication的设置打开。

启动ssh的服务:

systemctl start sshd.service

设置开机自动启动ssh服务

systemctl enable sshd.service



Tag:
相关文章

发表评论:取消回复