How to change folder permissions during package installation

Nuno V.

I'm making a deb package to install a custom application. I changed all files/folders ownership to root in order to avoid the warnings I was getting during installation, and in Ubuntu all runs smoothly, as Ubuntu changes the ownership of the files/folders to the user installing the package.

But when I'm installing on Debian, root remains the owner. The application uses a folder to write data, and here is the problem. Running as a standard user, the app does not have permission to write on the folder.

Now, how should I deal with this problem? Should I make a post install script on the deb package, doing the chmod o+w? Should I package the directory already with those permissions set?

Or is there any way of setting the owner of the files to the user that installs the app automatically (like Ubuntu does)?

Stephen Kitt

I'm not sure what the behaviour is in Ubuntu, but in general for a .deb package containing files or directories with non-standard permissions you need to ensure those permissions are set after dh_fixperms is run. If you're using a dh-style rules, you can do this as follows:

override_dh_fixperms:
        dh_fixperms
        chmod 777 yourfolder

You can also do this in a postinst:

if [ "$1" = "configure" ]; then
    chmod 777 yourfolder
fi

but the rules approach is simpler (at least, I prefer doing that rather than relying on maintainer scripts).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Inno Setup - How to set permissions of installation folder

From Dev

How to get permissions to a folder in an installation process?

From Dev

How to set an environment variable during package installation

From Dev

Change folder permissions and ownership

From Dev

Change folder permissions and ownership

From Dev

Cannot change permissions to folder

From Dev

Change owner and permissions of folder

From Dev

How to remove additional folder during uninstallation of Debian package?

From Dev

How to create package including source codes, which compile during installation

From Dev

How to handle failed dependencies during installation of a deb package (with dpkg)

From Dev

How to change permissions for a folder and its subfolders/files in one step?

From Dev

How would I change a folder to user read and write permissions?

From Dev

Files inside folder change their permissions

From Dev

Why are two permissions always requested during installation?

From Dev

How to change Application Settings during InstallShield Installation Process?

From Dev

How to change Installation Folder Url after publish the Application

From Java

How do I change file permissions on /tmp during and elastic beanstalk app deploy?

From Dev

Nuget Package Error during Installation of MongoDB driver

From Dev

How to add a SID to a folder permissions

From Dev

Change Folder & File Permissions for all Subdirectories

From Dev

Samba could not change the permissions of folder "Network"

From Dev

Change Folder & File Permissions for all Subdirectories

From Dev

Samba could not change the permissions of folder "Network"

From Dev

Change group permissions on linux shared folder

From Dev

Change Folder/File Permissions for HIDDEN Subdirectories

From Dev

change home folder permissions on exit/disconnect

From Dev

Change only file permissions in a folder NOT RECURSIVELLY

From Dev

Change permissions of windows mounted folder from linux

From Dev

how to change permissions on SSAS

Related Related

  1. 1

    Inno Setup - How to set permissions of installation folder

  2. 2

    How to get permissions to a folder in an installation process?

  3. 3

    How to set an environment variable during package installation

  4. 4

    Change folder permissions and ownership

  5. 5

    Change folder permissions and ownership

  6. 6

    Cannot change permissions to folder

  7. 7

    Change owner and permissions of folder

  8. 8

    How to remove additional folder during uninstallation of Debian package?

  9. 9

    How to create package including source codes, which compile during installation

  10. 10

    How to handle failed dependencies during installation of a deb package (with dpkg)

  11. 11

    How to change permissions for a folder and its subfolders/files in one step?

  12. 12

    How would I change a folder to user read and write permissions?

  13. 13

    Files inside folder change their permissions

  14. 14

    Why are two permissions always requested during installation?

  15. 15

    How to change Application Settings during InstallShield Installation Process?

  16. 16

    How to change Installation Folder Url after publish the Application

  17. 17

    How do I change file permissions on /tmp during and elastic beanstalk app deploy?

  18. 18

    Nuget Package Error during Installation of MongoDB driver

  19. 19

    How to add a SID to a folder permissions

  20. 20

    Change Folder & File Permissions for all Subdirectories

  21. 21

    Samba could not change the permissions of folder "Network"

  22. 22

    Change Folder & File Permissions for all Subdirectories

  23. 23

    Samba could not change the permissions of folder "Network"

  24. 24

    Change group permissions on linux shared folder

  25. 25

    Change Folder/File Permissions for HIDDEN Subdirectories

  26. 26

    change home folder permissions on exit/disconnect

  27. 27

    Change only file permissions in a folder NOT RECURSIVELLY

  28. 28

    Change permissions of windows mounted folder from linux

  29. 29

    how to change permissions on SSAS

HotTag

Archive