1

I'm creating a program for Ubuntu that involves creation of files within the folder where the code is present.
What I want to know is: When a .deb package is installed, where do the contents go?
If a program makes modifications to or creates new files within the /... directory, does it require root privileges?

2
  • Yeah..you need root privileges to create files in root directory.(while installing through .deb we need to run the commands with sudo..so it kinda give permissions for editing )
    – hunch
    Jun 26, 2015 at 19:42
  • 1
    You should modify your application to create files at runtime in a dedicated folder in the user's home directory. Maybe we can help you a bit better if you specify what the application does and what kind of files are created.
    – Timo
    Jun 28, 2015 at 12:14

1 Answer 1

3

Strictly, the directory: / is the "root" directory of all directories. That includes all sub- directories, so includes your home directory as well.

You need additional privileges for all directories outside ~ (your homedirectory), so either you need to:

  • be member of a specific group (e.g. to share files or directories), or, more drastically,
  • you need sudo privileges

outside your personal home directory.

A .deb installer, to install items globally for all users, will therefore need t be run with sudo privileges, since it installs files and executables outside your home directory.

When a .deb package is installed, where do the contents go?

Although there are quite strict rules for using directories outside your home directory, there is no easy answer to that; it depends on the application, its role and what kind of application it is. See also here and here (among others).

If you want to get an impression on where files are installed, look inside an unzipped .deb installer of a simple application. It contains a scaled version of your system and shows where the files will be "projected" to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .