首页 > 系统相关 >linux 操作系统下 dpkg-statoverride命令介绍和使用案例

linux 操作系统下 dpkg-statoverride命令介绍和使用案例

时间:2024-10-22 08:50:35浏览次数:3  
标签:statoverride force -- openssl linux root dpkg

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

相关文章

  • linux后台运行python脚本
    一、使用sytemctl运行service准备需要运行的脚本HelloWorld.py,配置文件HelloWorld.servce十秒打印一次日志importtimeimportlogging#配置日志记录器logging.basicConfig(level=logging.INFO,format='%(asctime)s-%(message)s',datefmt='%Y-%m-%d%H:%M:%S')while......
  • Linux通过复制网卡信息配置链路聚合
    1.首先通过命令查看网卡信息名称ifconfig2.之后进入到example_ifcfgs/3文件夹中cd/usr/share/doc/teamd-1.25/example_ifcfgs/33.然后分别修改eth1、eth2、team_test0修改里面的配置信息(使用以下命令是已经进入到目录/usr/share/doc/teamd-1.25/example_ifcfgs/3视图下)......
  • Linux系统基础-动静态库
    个人主页:C++忠实粉丝欢迎点赞......
  • 考场环境 NoiLinux 测试
    觉得还是有必要提前练一下用的是官网的NoiLinux.iso全程断网下载虽然不知道实机预安装系统时是不是断网的NoiLinux,但是保险一点还是选了断网省选的时候,Windows里只有画图和Dev-C++分辨率非常构式,需要手动调分辨率,咱们电脑是1920*1080(没找到适配这个电脑的分辨率),到时......
  • 13、Linux网络管理
    网络基本概念物理地址/逻辑地址物理地址:硬件地址,如MAC地址。逻辑地址:软件配置地址,如IP地址。网卡作用:连接计算机和网络的硬件设备。MAC地址(MediaAccessControl)定义:媒体访问控制地址,唯一标识网络设备的硬件地址。IP地址(InternetProtocolAddress)格式示例:......
  • Linux_进程理解、状态与优先级(详细版)
    1.进程的概念课本概念:程序的一个执行实例,正在执行的程序等。内核观点:担当分配系统资源(CPU时间,内存)的实体。其实:进程=内核的相关管理数据结构(task_struct、页表等)+程序的代码和数据task_struct:是描述进程的结构体,是Linux内核的一种数据结构,它会被装载到RAM(内存)里并且包含着......
  • Linux下安装JDK1.8,CentOS7安装JDK1.8/Java8
    一、卸载自带的先检查是否有安装自带的openjdkrpm-qa|grepjava如果有,卸载rpm-e--nodeps#openjdk的名字逐个卸载完之后,确保java-version没有东西二、下载上传下载tar.gz安装包到本地例如zulu的https://www.azul.com/downloads/#downloads-table-zulu例如/usr/bi......
  • 【Linux从入门到精通三】Linux目录结构与基础命令详解
    个人名片......
  • 【Linux从入门到精通四】基础命令详解:cd、pwd、mkdir、文件操作与管道符
    个人名片......
  • 如何快速安装和配置Linux下 Anaconda 以提高开发效率
    1.下载Linux版Anaconda前往Anaconda下载页面,选择合适的版本下载。2.安装Anaconda进入下载的Anaconda目录并运行安装脚本:cd/path/to/conda-directorybashAnaconda3-2024.06-1-Linux-x86_64.sh3.重新加载配置安装完成后,重新加载配置文件以便命令生效:source~/......