-   Linux - Newbie (
-   -   General Fakeroot Question (

linutzy 06-09-2011 05:28 PM

General Fakeroot Question
I did a standard Google search, and it usually just came up with the man pages, which is fine, but I could use more insight.

Why use fakeroot when you already have root privileges/password?

neonsignal 06-09-2011 07:51 PM

There are a few situations where it is useful to be able to preserve the ownership properties of a file. These include making archives, backups, building a kernel, and so on.

In a context where you already have the ability to access root privileges, you can of course just perform the action as root user. So why not?

1. Every action that is performed with root privileges is a potential security issue. In general, the less code that runs with root privileges the better.

2. Some actions (especially backups) are scripted. Where these scripts are automated, then running as root would mean giving them automated access to the root account. However, providing a script with automated root login (eg using sudo) requires very careful thought to prevent abuse; easier just to use fakeroot and know there is not a problem.

3. When creating copies of various system files with all their properties, fakeroot will still be excluded from access to those that are readable only by root. In other words, a backup or archive done as root user may expose sensitive information (such as unencrypted passwords and private keys).

Of course, there are many actions where fakeroot is not useful, but for the few situations where it is, it is a neat way to keep from having to escalate privileges.

All times are GMT -5. The time now is 10:06 AM.