Wr's Blog Wr's Blog
  • Home
  • Blog
  • Tags
    • Tutorials
    • Res
  • About
首页 分享 [教程] 腾讯云服务器 Ubuntu 实例开启 root 用户通过密码 SSH 远程登录教程

[教程] 腾讯云服务器 Ubuntu 实例开启 root 用户通过密码 SSH 远程登录教程

_Wr_ 2 years ago

腾讯云云服务器 CVM 与 轻量应用服务器 Lighthouse 的 Ubuntu 实例的默认用户名是 ubuntu,并在安装过程中默认不设置 root 帐户和密码且禁用 root 用户通过密码 SSH 远程登录。如需使用 root 账户,具体操作步骤如下:

1. 登录 Ubuntu 实例

使用 SSH 客户端连接您的服务器,Win 下推荐使用 Xshell/Termius; Mac 下推荐使用 Termius; Linux 直接用 Shell 吧 推荐使用 FinalShell

如果你尚未设置服务器 SSH 密码,请先前往 腾讯云>控制台>轻量应用云服务器 Lighthouse>你的实例 重置密码。

SSH 配置如下:

IP: 你服务器的公网 IP

端口: 默认 22

用户名: ubuntu

密码: 你设置的密码

2. 设置 root 密码

Ubuntu 实例在安装过程中默认不设置 root 帐户和密码,需要通过以下步骤手动设置

sudo passwd root

3. 输入 root 密码, 按下 Enter

如果你是 Linux 新手,你可能会注意到 SSH 终端并不会显示你的密码。碰到这种情况不用担心,忽略即可~

4. 再次输入 root 密码, 按下 Enter

当终端返回以下消息,就说明 root 密码设置完毕

passwd: password updated successfully

5. 改变 root 用户 SSH 登录设置

使用 vim 修改 /etc/ssh/sshd_config 配置文件

sudo vim /etc/ssh/sshd_config

输入 i 进入 INSERT 编辑模式

定位到 PermitRootLogin (大概在 35 行) ,删除 # 注释符号,并改为以下代码

PermitRootLogin yes

在这一行下面,请加入以下代码

PasswordAuthentication yes

按下 Esc 退出 INSERT 编辑模式,输入 ZZ 保存并退出

6. 重启 SSH 服务

执行以下命令

sudo service ssh restart

7. 使用 SSH 客户端登录 root 账户

用户名: root

密码: 你设置的 root 密码

Done!

Enjoy!

# Linux# Ubuntu# 教程# 服务器# 腾讯云
0
_Wr_
?

Comments (2)

Back
  • Tito

    举报了 文章涉嫌乳Tito [哼]

    2 years ago Reply
    • _Wr_

      @Tito 哼,你怎么对号入座了

      2 years ago Reply
_Wr_
?
11
Posts
53
Comments
0
Likes

文章聚合

CRI Hit FM 劲曲调频 m3u8 直播流 (可在线播放)
1 year ago
[教程] 腾讯云服务器 Ubuntu 实例开启 root 用户通过密码 SSH 远程登录教程
2 years ago
[教程]《索尼克大冒险 2》PC 版 Mod 制作教程 (一): 各文件/目录的详细作用
2 years ago
去除 WordPress 管理菜单栏 WordPress logo
3 years ago
解决无法修改 .user.ini 文件的问题
3 years ago
使用 Python 爬取 WordPress.org 上所有插件json信息
3 years ago
解决在 macOS 上程序已损坏、无法打开、需丢进废纸篓的问题
4 years ago
如何使 Chrome 浏览器开启多线程下载
4 years ago
如何在不支持 Sidecar 的 Mac 上使用 Sidecar
4 years ago
如何在 Mac 下查看或恢复隐藏文件
4 years ago
如何使用 KMS 激活 Windows
4 years ago
Copyright © 2019-2023 Wr's Blog. Designed by nicetheme.
  • Home
  • Blog
  • Tags
    • Tutorials
    • Res
  • About