fsperm

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fsperm 在创建文件和目录后显式设置权限。

部分文件系统会忽略创建时传入的权限:例如飞牛 fnOS 以 trimacl 挂载的 btrfs 卷, 新建的文件和目录一律按继承规则变成 0755,只有创建后再 chmod 才生效。 配置目录里有令牌、私钥、配置历史和访问日志,在其中创建文件都应当经过这里。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MkdirAll

func MkdirAll(dir string, perm os.FileMode) error

MkdirAll 与 os.MkdirAll 相同,随后把 dir 本身的权限设为 perm(不改动已存在的上级目录)。

func Tighten

func Tighten(root string) int

Tighten 收紧 root(文件或目录)及其下已有内容的权限:带有组或其他用户权限的目录改为 0700, 不是 0600 的普通文件改为 0600(这些目录只存数据,执行位一并去掉)。不跟随符号链接;root 不存在时什么也不做。 用于修复旧版本在上述文件系统上创建的文件,返回改动的数量。

文件不能只看组和其他用户位:飞牛的 trimacl 卷在收紧目录时会把子项一起改成 0700,保留了执行位。

func WriteFile

func WriteFile(name string, data []byte, perm os.FileMode) error

WriteFile 与 os.WriteFile 相同,随后把文件权限设为 perm。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL