Files
Nexus/docs/deploy/nexus-files-sudoers.example
T

26 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Nexus 文件管理 — 目标机免密 sudo 示例(须运维审阅后安装)
#
# 安装步骤(在目标服务器上):
# 1. 将本文件复制为 /etc/sudoers.d/nexus-files(权限 0440
# 2. 把下面 deploy 替换为 Nexus 里该服务器的 SSH 用户名
# 3. visudo -cf /etc/sudoers.d/nexus-files
# 4. 用该 SSH 用户执行:sudo -n true && sudo -n bash -c 'command -v chmod'
#
# 说明:
# - 后端在权限失败时会执行 sudo -n bash -c '…',因此必须允许 /bin/bash 或 /usr/bin/bash
# - 写入回退还会用到 tee、mv、mkdir、rm、cat 等
# - 禁止使用 ALL=(ALL) NOPASSWD: ALL
deploy ALL=(ALL) NOPASSWD: \
/bin/bash, /usr/bin/bash, \
/bin/chmod, /usr/bin/chmod, \
/bin/chown, /usr/bin/chown, \
/bin/cp, /usr/bin/cp, \
/bin/mv, /usr/bin/mv, \
/bin/mkdir, /usr/bin/mkdir, \
/bin/rm, /usr/bin/rm, \
/bin/tar, /usr/bin/tar, \
/usr/bin/unzip, /usr/bin/zip, \
/usr/bin/tee, /bin/cat, /usr/bin/cat, \
/usr/bin/touch, /bin/touch