dpkg-statoverride
是一个用于管理 Debian 和基于 Debian 的 Linux 发行版(如 Ubuntu)中文件的所有权和权限的命令。它允许用户在软件包安装时覆盖文件的默认所有权和权限设置
命令概述
dpkg-statoverride
命令提供了三种基本功能:
- 添加覆盖
- 删除覆盖
- 列出当前的覆盖
命令语法
bash
dpkg-statoverride [选项...] <命令>
常用选项
--add <用户> <用户组> <权限> <路径>
:为指定路径添加一个新的覆盖。路径不需要存在,覆盖将被存储并在以后使用。权限需要以八进制形式指定。--remove <路径>
:从数据库中删除指定路径的覆盖,路径的状态保持不变。--list [<glob模式>]
:列出当前数据库中的所有覆盖。如果指定了 glob 模式,则仅显示匹配的覆盖。--update
:如果路径存在,立即更新其所有者和权限。--force
:强制执行操作,即使没有通过自检。--quiet
:尽可能少地输出信息。
命令介绍
root@meng:/data/rancher/rancher# which dpkg-statoverride
/usr/bin/dpkg-statoverride
root@meng:/data/rancher/rancher# dpkg-statoverride list
dpkg-statoverride: error: need an action option
Use --help for help about overriding file stat information.
root@meng:/data/rancher/rancher# dpkg-statoverride --help
Usage: dpkg-statoverride [<option> ...] <command>
Commands:
--add <owner> <group> <mode> <path>
add a new <path> entry into the database.
--remove <path> remove <path> from the database.
--list [<glob-pattern>] list current overrides in the database.
Options:
--admindir <directory> set the directory with the statoverride file.
--instdir <directory> set the root directory, but not the admin dir.
--root <directory> set the directory of the root filesystem.
--update immediately update <path> permissions.
--force deprecated alias for --force-all.
--force-<thing>[,...] override problems (see --force-help).
--no-force-<thing>[,...] stop when problems encountered.
--refuse-<thing>[,...] ditto.
--quiet quiet operation, minimal output.
--help show this help message.
--version show the version.
使用案例
将 /var/lib/openssl
的所有者更改为 openssl
用户和组,并设置权限为 751
dpkg-statoverride --add openssl openssl 751 /var/lib/openssl
立即更新 /var/lib/openssl
的权限,可以使用 --update
:
dpkg-statoverride --update --add openssl openssl 751 /var/lib/openssl
强制更新某个路径的权限,即使它已经有覆盖,可以使用 --force
:
dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
查看当前系统中所有的覆盖,可以使用
dpkg-statoverride --list
标签:statoverride,force,--,openssl,linux,root,dpkg From: https://blog.csdn.net/lisanmengmeng/article/details/142934911