← 返回命令列表

Linux command

fakeroot 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

fakeroot

Example

fakeroot -- [command] [command_arguments]

Example

fakeroot -s [path/to/file] -- [command] [command_arguments]

Load

fakeroot -i [path/to/file] -- [command] [command_arguments]

Keep

fakeroot [-u|--unknown-is-real] -- [command] [command_arguments]

Example

fakeroot [-h|--help]

说明

fakeroot runs commands in an environment that fakes root privileges for file manipulation. It intercepts system calls to make files appear owned by root without actual root access. The tool uses LD_PRELOAD to intercept library calls and maintain a database of fake ownership and permission information. When a program creates a file, fakeroot records it as owned by root (uid 0, gid 0) while the actual file on disk retains the user's ownership. This is commonly used for building packages (particularly Debian .deb packages) that need to create root-owned files. The saved environment (-s/-i) allows preserving fake ownership across multiple commands and sessions.

参数

-s _file_
Save fakeroot environment on exit.
-i _file_
Load fakeroot environment from a previous session.
-u, --unknown-is-real
Keep real ownership of files not tracked by fakeroot.
-b _fd_
File descriptor for faked library to use.
-h, --help
Display help.
-v, --version
Display version.

FAQ

What is the fakeroot command used for?

fakeroot runs commands in an environment that fakes root privileges for file manipulation. It intercepts system calls to make files appear owned by root without actual root access. The tool uses LD_PRELOAD to intercept library calls and maintain a database of fake ownership and permission information. When a program creates a file, fakeroot records it as owned by root (uid 0, gid 0) while the actual file on disk retains the user's ownership. This is commonly used for building packages (particularly Debian .deb packages) that need to create root-owned files. The saved environment (-s/-i) allows preserving fake ownership across multiple commands and sessions.

How do I run a basic fakeroot example?

Run `fakeroot` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s _file_ do in fakeroot?

Save fakeroot environment on exit.