> ## Content Index
> Fetch the complete content index at: https://sgpublic.xyz/llms.txt
> Use this file to discover other available public pages before exploring further.

# 单独授予某可执行绑定 1024 以下端口号的权限、sudo 免密码权限
- URL: https://sgpublic.xyz/p/2026/10/6ad5b024404a0500012b81b6/
- Published: 2026-10-19T06:56:06.000Z
- Updated: 2026-10-19T06:56:40.000Z
- Author: Haven Madray
- Tags: 运维

在使用 process-compose 的时候，遇到一个需求，我需要一个服务监听 53 端口，按照 Linux 默认限制，监听 1024 以下端口号，需要 root 权限，但 process-compose 切换 root 执行不是很方便，于是需要单独授予。

### 单独授予某可执行 1024 以下端口号监听权限

使用以下命令授予：

```shell
sudo setcap cap_net_bind_service=+ep "/your/executable"
```

### 单独授予某可执行 sudo 免密码权限

这里是指 `sudo /your/executable` 时无须输入密码，仅执行 `/your/executable` 时有效。修改 `/etc/sudoers` 文件，添加以下内容：

```
ubuntu ALL=(root) NOPASSWD: /your/executable
```

验证：

```shell
sudo -n /your/executable
```

没有报错 `sudo: a password is required` 即可。