{
    "mode": "man",
    "parameter": "fakeroot-sysv",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/fakeroot-sysv/1/json",
    "generated": "2026-05-30T06:07:16Z",
    "synopsis": "fakeroot  [-l|--lib  library]  [--faked faked-binary] [-i load-file] [-s save-file] [-u|--un‐‐",
    "sections": {
        "NAME": {
            "content": "fakeroot - run a command in an environment faking root privileges for file manipulation\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "fakeroot  [-l|--lib  library]  [--faked faked-binary] [-i load-file] [-s save-file] [-u|--un‐‐",
            "subsections": [
                {
                    "name": "known-is-real ] [-b|--fd-base ] [-h|--help ] [-v|--version ] [--] [command]",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "fakeroot runs a command in an environment wherein it appears to have root privileges for file\nmanipulation.  This is useful for allowing users to create archives (tar, ar, .deb etc.) with\nfiles in them with root permissions/ownership.  Without fakeroot one would need to have  root\nprivileges  to  create the constituent files of the archives with the correct permissions and\nownership, and then pack them up, or one would have to construct the archives directly, with‐\nout using the archiver.\n\nfakeroot  works by replacing the file manipulation library functions (chmod(2), stat(2) etc.)\nby ones that simulate the effect the real library functions would have had, had the user  re‐\nally  been  root. These wrapper functions are in a shared library /usr/lib/*/libfakeroot-*.so\nor similar location on your platform.  The shared object is  loaded  through  the  LDPRELOAD\nmechanism of the dynamic loader. (See ld.so(8))\n\nIf  you  intend  to  build  packages  with fakeroot, please try building the fakeroot package\nfirst: the \"debian/rules build\" stage has a few tests (testing mostly for bugs in  old  fake‐\nroot  versions).  If those tests fail (for example because you have certain libc5 programs on\nyour system), other packages you build with fakeroot will quite likely fail too, but possibly\nin much more subtle ways.\n\nAlso,  note  that it's best not to do the building of the binaries themselves under fakeroot.\nEspecially configure and friends don't like it when the system suddenly  behaves  differently\nfrom  what  they  expect.  (or, they randomly unset some environment variables, some of which\nfakeroot needs).\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-l --lib",
                    "content": "Specify an alternative wrapper library.\n\n--faked binary\nSpecify an alternative binary to use as faked.\n\n[--] command\nAny command you want to be ran as fakeroot. Use ‘--’ if in the command you have  other\noptions that may confuse fakeroot's option parsing.\n",
                    "flag": "-l",
                    "long": "--lib"
                },
                {
                    "name": "-s",
                    "content": "Save  the  fakeroot environment to save-file on exit. This file can be used to restore\nthe environment later using -i. However, this file will leak and fakeroot will  behave\nin  odd ways unless you leave the files touched inside the fakeroot alone when outside\nthe environment. Still, this can be useful. For example, it can be used with  rsync(1)\nto  back up and restore whole directory trees complete with user, group and device in‐\nformation without needing to be root.  See  /usr/share/doc/fakeroot/README.saving  for\nmore details.\n",
                    "flag": "-s"
                },
                {
                    "name": "-i",
                    "content": "Load  a fakeroot environment previously saved using -s from load-file.  Note that this\ndoes not implicitly save the file, use -s as well for that behaviour. Using  the  same\nfile for both -i and -s in a single fakeroot invocation is safe.\n",
                    "flag": "-i"
                },
                {
                    "name": "-u --unknown-is-real",
                    "content": "Use  the  real ownership of files previously unknown to fakeroot instead of pretending\nthey are owned by root:root.\n",
                    "flag": "-u",
                    "long": "--unknown-is-real"
                },
                {
                    "name": "-b",
                    "content": "TCP  connections;  this  may be important to avoid conflicts with the file descriptors\nused by the programs being run under fakeroot.\n",
                    "flag": "-b"
                },
                {
                    "name": "-h",
                    "content": "",
                    "flag": "-h"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                }
            ]
        },
        "EXAMPLES": {
            "content": "Here is an example session with fakeroot.  Notice that inside the fake root environment  file\nmanipulation that requires root privileges succeeds, but is not really happening.\n\n$  whoami\njoost\n$ fakeroot /bin/bash\n#  whoami\nroot\n# mknod hda3 b 3 1\n# ls -ld hda3\nbrw-r--r--   1 root     root       3,   1 Jul  2 22:58 hda3\n# chown joost:root hda3\n# ls -ld hda3\nbrw-r--r--   1 joost    root       3,   1 Jul  2 22:58 hda3\n# ls -ld /\ndrwxr-xr-x  20 root     root         1024 Jun 17 21:50 /\n# chown joost:users /\n# chmod a+w /\n# ls -ld /\ndrwxrwxrwx  20 joost    users        1024 Jun 17 21:50 /\n# exit\n$ ls -ld /\ndrwxr-xr-x  20 root     root         1024 Jun 17 21:50 //\n$ ls -ld hda3\n-rw-r--r--   1 joost    users           0 Jul  2 22:58 hda3\n\nOnly the effects that user joost could do anyway happen for real.\n\nfakeroot was specifically written to enable users to create Debian GNU/Linux packages (in the\ndeb(5) format) without giving them root privileges.  This can be done by commands like  dpkg-\nbuildpackage  -rfakeroot  or  debuild  -rfakeroot (actually, -rfakeroot is default in debuild\nnowadays, so you don't need that argument).\n",
            "subsections": []
        },
        "SECURITY ASPECTS": {
            "content": "fakeroot is a regular, non-setuid program. It does not enhance a user's  privileges,  or  de‐\ncrease the system's security.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/usr/lib/*/libfakeroot-*.so The shared library containing the wrapper functions.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "FAKEROOTKEY\nThe  key  used  to  communicate with the fakeroot daemon. Any program started with the\nright LDPRELOAD and a FAKEROOTKEY of a running daemon will automatically  connect  to\nthat  daemon,  and  have  the same \"fake\" view of the file system's permissions/owner‐\nships.  (assuming the daemon and connecting program were started by the same user).\n\nLDLIBRARYPATH\n\nLDPRELOAD\nFakeroot is implemented by wrapping system calls.  This  is  accomplished  by  setting\nLDLIBRARYPATH=/usr/lib/fakeroot  and  LDPRELOAD=libfakeroot.so.0.   That library is\nloaded before the system's C library, and so most of the library functions are  inter‐\ncepted  by  it.  If you need to set either LDLIBRARYPATH or LDPRELOAD from within a\nfakeroot environment, it should be set relative to  the  given  paths,  as  in  LDLI‐‐\nBRARYPATH=$LDLIBRARYPATH:/foo/bar/\n\n",
            "subsections": []
        },
        "LIMITATIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "Library versions",
                    "content": "Every command executed within fakeroot needs to be linked to the same version of the C\nlibrary as fakeroot itself.\n"
                },
                {
                    "name": "open()/create()",
                    "content": "fakeroot doesn't wrap open(), create(), etc. So, if user joost does either\n\ntouch foo\nfakeroot\nls -al foo\n\nor the other way around,\n\nfakeroot\ntouch foo\nls -al foo\n\nfakeroot has no way of knowing that in the first case, the owner of foo really  should\nbe  joost  while  the second case it should have been root.  For the Debian packaging,\ndefaulting to giving all \"unknown\" files uid=gid=0, is always OK. The real way  around\nthis  is to wrap open() and create(), but that creates other problems, as demonstrated\nby the libtricks package. This package wrapped many more functions, and tried to do  a\nlot  more  than fakeroot .  It turned out that a minor upgrade of libc (from one where\nthe stat() function didn't use open() to one with a stat() function that did (in  some\ncases)  use  open()),  would  cause unexplainable segfaults (that is, the libc6 stat()\ncalled the wrapped open(), which would then call the libc6 stat(), etc).  Fixing  them\nwasn't  all  that  easy,  but  once fixed, it was just a matter of time before another\nfunction started to use open(), never mind trying to port it to a different  operating\nsystem. Thus I decided to keep the number of functions wrapped by fakeroot as small as\npossible, to limit the likelihood of ‘collisions’.\n"
                },
                {
                    "name": "GNU configure (and other such programs)",
                    "content": "fakeroot, in effect, is changing the way the system behaves. Programs that  probe  the\nsystem  like GNU configure may get confused by this (or if they don't, they may stress\nfakeroot so much that fakeroot itself becomes confused). So, it's advisable not to run\n\"configure\"  from  within fakeroot. As configure should be called in the \"debian/rules\nbuild\" target, running \"dpkg-buildpackage -rfakeroot\" correctly takes care of this.\n"
                }
            ]
        },
        "BUGS": {
            "content": "It doesn't wrap open(). This isn't  bad  by  itself,  but  if  a  program  does  open(\"file\",\nOWRONLY,  000),  writes  to file \"file\", closes it, and then again tries to open to read the\nfile, then that open fails, as the mode of the file will be 000. The bug is that if root does\nthe  same,  open()  will  succeed,  as the file permissions aren't checked at all for root. I\nchoose not to wrap open(), as open() is used by many other functions in libc (also those that\nare  already wrapped), thus creating loops (or possible future loops, when the implementation\nof various libc functions slightly change).\n",
            "subsections": []
        },
        "COPYING": {
            "content": "fakeroot is distributed under the GNU General Public License.  (GPL 2.0 or greater).\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "joost witteveen\n<joostje@debian.org>\n\nClint Adams\n<clint@debian.org>\n\nTimo Savola\n",
            "subsections": []
        },
        "MANUAL PAGE": {
            "content": "mostly by J.H.M. Dassen <jdassen@debian.org> Rather a lot mods/additions by joost and Clint.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "faked(1) dpkg-buildpackage(1), debuild(1) /usr/share/doc/fakeroot/DEBUG\n\n\n\n\nDebian Project                             5 October 2014                                fakeroot(1)",
            "subsections": []
        }
    },
    "summary": "fakeroot - run a command in an environment faking root privileges for file manipulation",
    "flags": [
        {
            "flag": "-l",
            "long": "--lib",
            "arg": null,
            "description": "Specify an alternative wrapper library. --faked binary Specify an alternative binary to use as faked. [--] command Any command you want to be ran as fakeroot. Use ‘--’ if in the command you have other options that may confuse fakeroot's option parsing."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "Save the fakeroot environment to save-file on exit. This file can be used to restore the environment later using -i. However, this file will leak and fakeroot will behave in odd ways unless you leave the files touched inside the fakeroot alone when outside the environment. Still, this can be useful. For example, it can be used with rsync(1) to back up and restore whole directory trees complete with user, group and device in‐ formation without needing to be root. See /usr/share/doc/fakeroot/README.saving for more details."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "Load a fakeroot environment previously saved using -s from load-file. Note that this does not implicitly save the file, use -s as well for that behaviour. Using the same file for both -i and -s in a single fakeroot invocation is safe."
        },
        {
            "flag": "-u",
            "long": "--unknown-is-real",
            "arg": null,
            "description": "Use the real ownership of files previously unknown to fakeroot instead of pretending they are owned by root:root."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "TCP connections; this may be important to avoid conflicts with the file descriptors used by the programs being run under fakeroot."
        },
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "examples": [
        "Here is an example session with fakeroot.  Notice that inside the fake root environment  file",
        "manipulation that requires root privileges succeeds, but is not really happening.",
        "$  whoami",
        "joost",
        "$ fakeroot /bin/bash",
        "#  whoami",
        "root",
        "# mknod hda3 b 3 1",
        "# ls -ld hda3",
        "brw-r--r--   1 root     root       3,   1 Jul  2 22:58 hda3",
        "# chown joost:root hda3",
        "# ls -ld hda3",
        "brw-r--r--   1 joost    root       3,   1 Jul  2 22:58 hda3",
        "# ls -ld /",
        "drwxr-xr-x  20 root     root         1024 Jun 17 21:50 /",
        "# chown joost:users /",
        "# chmod a+w /",
        "# ls -ld /",
        "drwxrwxrwx  20 joost    users        1024 Jun 17 21:50 /",
        "# exit",
        "$ ls -ld /",
        "drwxr-xr-x  20 root     root         1024 Jun 17 21:50 //",
        "$ ls -ld hda3",
        "-rw-r--r--   1 joost    users           0 Jul  2 22:58 hda3",
        "Only the effects that user joost could do anyway happen for real.",
        "fakeroot was specifically written to enable users to create Debian GNU/Linux packages (in the",
        "deb(5) format) without giving them root privileges.  This can be done by commands like  dpkg-",
        "buildpackage  -rfakeroot  or  debuild  -rfakeroot (actually, -rfakeroot is default in debuild",
        "nowadays, so you don't need that argument)."
    ],
    "see_also": [
        {
            "name": "faked",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/faked/1/json"
        },
        {
            "name": "dpkg-buildpackage",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/dpkg-buildpackage/1/json"
        },
        {
            "name": "debuild",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/debuild/1/json"
        }
    ]
}