温馨提示×

debian cobbler如何设密码

小樊
48
2026-10-06 17:44:47
栏目: 智能运维

在 Debian 上使用 Cobbler 时,“设密码”通常分为几种场景。下面按常见需求分别说明。


一、设置 Cobbler Web 界面(cobbler-web)登录密码

Cobbler 早期版本提供 Web 管理界面,用户一般是 cobbler。

1. 修改 cobbler 用户密码(本地认证)

如果是用 authn_configfile 方式:

htdigest /etc/cobbler/users.digest "Cobbler" cobbler

按提示输入新密码。

文件位置可能不同,常见:

  • /etc/cobbler/users.digest
  • /etc/cobbler/users.settings

2. 确认 Web 认证方式

编辑:

/etc/cobbler/modules.conf

确保:

[authentication]
module = authn_configfile

重启服务:

systemctl restart cobblerd

二、设置 Cobbler CLI 访问密码(Web 同步密码)

Cobbler 命令行需要连接 XMLRPC,默认有 default_password_crypted。

1. 生成加密密码

openssl passwd -1

或

python3 -c 'import crypt; print(crypt.crypt("你的密码", crypt.mksalt(crypt.METHOD_SHA512)))'

2. 写入 Cobbler 配置

编辑:

/etc/cobbler/settings.yaml

设置:

default_password_crypted: "$1$xxx$xxxxxxxxxxxx"

然后:

cobbler sync

三、设置 PXE / 系统 root 密码(部署后系统密码)

这是装机后系统的 root 密码。

方法 1:在 profile / system 中设置

cobbler system edit --name=node01 \
  --kernel-options="net.ifnames=0 biosdevname=0" \
  --password-crypted='$6$xxxx'

方法 2:在 Kickstart 中设置

在 .ks 文件里:

rootpw --iscrypted $6$xxxxxxxxxxxx

生成方式:

python3 -c 'import crypt; print(crypt.crypt("密码", crypt.mksalt(crypt.METHOD_SHA512)))'

四、设置 TFTP / PXE 启动无密码(通常不需要)

PXE 启动本身没有密码机制,如果要限制:

  • 使用 MAC 白名单
  • 或网络隔离

五、Debian 上 Cobbler 相关服务重启

systemctl restart cobblerd
systemctl restart apache2   # 若使用 cobbler-web
cobbler sync

总结

场景 配置位置
Web 登录 users.digest / modules.conf
CLI 密码 settings.yaml
装机系统 root kickstart / system
PXE 启动 无密码

如果你能说明具体是哪一种密码(Web?root?CLI?),我可以给你更精确的命令。

0 踩