Create New Document

The title of your document (will be displayed as H1)
URL-friendly name (no spaces, use dashes)
Path where to create document (optional, use forward slashes to create subdirectories)

Move/Rename Document

Current location of the document
New path for the document (including the slug)
This only changes the document's path. It does not modify the document's title (H1 heading).

Delete Document

Are you sure you want to delete this document? This action cannot be undone.

Warning: If this is a folder, all contents including subfolders and documents will be deleted.

Message

Message content goes here.

Confirm Action

Are you sure?

Attachments

Allowed file types: jpg, jpeg, png, gif, svg, webp, txt, log, csv, sfd, zip, pdf, docx, xlsx, pptx, mp4 (Max: 10MB)

Document Files

Loading attached files...

Document History

Previous Versions

Loading versions...

Preview

Select a version to preview

Wiki Settings

Language for the user interface
Number of versions to keep per document. Set to 0 to disable versioning.
Maximum allowed file size for uploads in MB.

User Management

Add New User

Leave empty to keep current password
Users with these groups can access restricted sections.

Define path-based access rules for sections of your wiki, then assign users to groups in the Users tab. Rules are evaluated in order. First match wins.

Active Rules

Import markdown files from a ZIP archive. Files will be processed and stored in the appropriate document structure. Directory structure in the ZIP (category/subcategory) will be preserved in the wiki.

Upload a ZIP file containing markdown (.md) files to import.

Create and manage backups of your wiki data. Backups include all documents, images, and configuration files.

Available Backups

Loading backups...

Add/Edit Access Rule

Selected: /

Add Column

Banner

root

在 Ubuntu 系统中,加固 Root 账户的核心安全策略是:禁用 Root 账户密码登录(使其无法被爆破),并禁止 Root 通过 SSH 远程登录(防止暴力破解)。同时,日常操作应使用普通用户 + sudo 提权。

以下是标准生产环境加固流程,包含详细命令与逐词解析。


第一步:设置一个强壮的普通用户(必须有此步骤)

绝对不要在只有 Root 的情况下禁用 Root,否则你会被锁在系统外。请先确保有一个属于 sudo 组的普通用户。

# 创建新用户(如果已有则跳过)
sudo adduser myadmin

# 将用户加入 sudo 管理员组(Ubuntu 默认组为 sudo)
sudo usermod -aG sudo myadmin

命令解析:


第二步:加固 Root 账户(锁定登录)

方法 A:锁定 Root 密码(最推荐)

锁定后,Root 无法通过任何终端(本地或 SSH)输入密码登录,但 Root 用户依然存在,sudo 和系统服务可以正常调用它。

sudo passwd -l root

命令解析:


方法 B:将 Root Shell 改为 nologin(可选)

彻底阻止 Root 交互式登录(但 Root 依然可以通过 su - 切换,除非同时锁定密码)。

sudo usermod -s /usr/sbin/nologin root

命令解析:

生产标准做法:通常 只执行 passwd -l root 就足够。


第三步:禁止 Root 通过 SSH 登录(最关键)

编辑 SSH 服务配置文件:

sudo vim /etc/ssh/sshd_config

在文件中找到或添加以下行(如果已有被注释的行 #PermitRootLogin,删除 # 并修改值):

PermitRootLogin no

参数解析:

保存并退出后,必须重启 SSH 服务生效:

sudo systemctl restart sshd

命令解析:


第四步:高级加固(可选但强烈建议)

1. 修改 SSH 默认端口(避开扫描器)

# 在 /etc/ssh/sshd_config 中找到 Port 22,改为:
Port 5022

解析: Port端口,改为非标准端口(如 5000-6000 之间的随机数)。

2. 禁用 Root 的 .rhosts 文件(防止 Rhosts 认证)

sudo touch /etc/hosts.deny
sudo touch /etc/hosts.allow
# 或者直接删除或清空 .rhosts 文件
sudo find / -name ".rhosts" -delete

第五步:验证加固是否生效(必须自检)

测试项目 命令/操作 预期结果
检查 Root 是否锁定 sudo passwd -S root 输出包含 L(Locked)
检查 SSH 配置 `sudo sshd -T grep permitrootlogin`
本地切换测试 su - root 提示 Authentication failure(认证失败)
远程测试(新窗口) ssh root@你的IP 提示 Permission denied(权限被拒绝)

passwd -S 解析: -S 代表 Status(状态),显示账户密码状态。


第六步:如果误操作导致无法登录怎么办?(应急方案)

如果你锁了 Root 且普通用户无法 sudo,请通过 VPS 控制台(VNC/救援模式)物理机外接键盘 进入恢复模式:

  1. 重启系统,在 Grub 引导时选择 “Advanced options” -> “Recovery mode” -> “Drop to root shell”

  2. 此时你拥有临时 Root Shell,执行:

    # 解锁 Root
    passwd -u root
    # 或修改 SSH 配置
    vi /etc/ssh/sshd_config
    

总结标准操作清单(复制即用)

# 1. 创建管理员用户(替换 yourname)
sudo adduser yourname
sudo usermod -aG sudo yourname

# 2. 锁定 Root
sudo passwd -l root

# 3. 禁止 SSH Root 登录
sudo sed -i 's/^#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
sudo systemctl restart sshd

# 4. 验证
sudo passwd -S root
sudo sshd -T | grep permitrootlogin

完成以上操作后,你的 Ubuntu Root 账户已满足 CIS 基准合规要求。 日常运维请使用普通用户 + sudo -i 临时切换到 Root 环境进行操作。

Attached Files

Loading attached files...
Search Results