Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 20.04 root ssh登录配置 #6

Open
wyb-cq opened this issue Jan 16, 2023 · 0 comments
Open

Ubuntu 20.04 root ssh登录配置 #6

wyb-cq opened this issue Jan 16, 2023 · 0 comments

Comments

@wyb-cq
Copy link
Owner

wyb-cq commented Jan 16, 2023

测试版本使用的Ubuntu 20.04,Ubuntu 16.4以上版本都可以这样配置。
最简单的方法:直接安装openssh-server,然后测试时候可以ssh登录,如果不可以,请使用下面的方法进行配置。

sudo apt install openssh-server

1. 设置root密码

执行命令后,依次输入当前登录用户密码,要设置的root密码,确认root密码

sudo passwd root

2. 修改ssh配置文件

如果没有安装ssh-server,执行安装命令,已经安装的跳过即可

sudo apt install openssh-server

修改配置文件

sudo vim /etc/ssh/sshd_config

在vim中搜索定位PermitRootLogin,可直接查找:

/PermitRootLogin

修改以下配置:

33 #LoginGraceTime 2m
34 #PermitRootLogin prohibit-password
35 #StrictModes yes
36 #MaxAuthTries 6
37 #MaxSessions 10

修改为:

 LoginGraceTime 2m
 PermitRootLogin yes
 StrictModes yes
 #MaxAuthTries 6
 #MaxSessions 10

3. 重启ssh,使配置生效

sudo service ssh restart

现在可是使用root用户登录ssh了!!!

@wyb-cq wyb-cq pinned this issue Jan 16, 2023
@wyb-cq wyb-cq unpinned this issue Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant