How to create .Deb pkg such that it should has access read write permission in /opt/myprogram - linux

I'm developing application that is installing in /opt folder. My application fetches .zip file and tries to write in /opt/myprogram/ but it is failing due to permission issues.
If I run as root it will work.
So how can I create Deb package such that it has full read and write permission for that user under /opt/myprogram

Related

GCP Filestore error modifying shared folder contents with nodejs script under non-root user

I want to write a program that writes log files into the shared folder in a GCP compute engine. I used GCP filestore to mount the NFS folder in an ubuntu vm. After creating the folder, I noticed that I couldn't use cp to copy file to that folder unless I use sudo. When I ran the nodejs script, it also returned a permission denied error. However, I don't want to run the nodejs script with root. Is there a way to modify the set of permission so that I can write to the shared folder under the default, non-root user?
I modified the permission of the shared folder to 777 but it didn't work. I still cannot write to the folder.

Lack of permissions in Windows

I created C:/Users/homedir/Documents/Python. Windows automatically
puts that in OneDrive's path. Is this causing the permission errors?
d#LAPTOP-M0R87BQ6 MINGW64 ~/OneDrive/Documents/Python/twilio-python-main (main)
$ python3 setup.py install
running install
error: can't create or remove files in install directory
# The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-9920.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages\
Is the only problem I need to create the directory (or modify setup.py to install in Python's path elsewhere)?
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.
I am the Admin for this machine, I'm in the Group Administrators. There is no higher root on my machine. I opened a PowerShell as an Admin and ran the python interpreter. Still insufficient permissions. Looking at Windows Explorer I am Owner of all the files.
The error says: "If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHON PATH environment variable."
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.
in cmd windows try taking ownership of WindowsApps folder and ensure the properties are inherited by its subfolders
takeown /f \"C:\Program Files\WindowsApps" && icacls \"C:\Program Files\WindowsApps" /grant administrators:F

Installing software on server machine - the install process wants to modify root folders which I cannot access

I'm configuring software on my first web server, so I am not totally familiar with how everything works, but here is the basic problem:
I have purchased hosting on a web server that runs on CentOS. I have been able to install postgreSQL via an install process that the hoster provides, so that my database will be local only to my home folder. That is working fine.
However, I am trying to install a postgreSQL extension called PostGIS. I have tried to compile it from source on my web server, but it now requires an additional library called GEOS. I downloaded the library from http://download/osgeo.org/geos/geos-3.6.2.tar.bz2, extracted it, and used make install to run it.
Now the problem is that it fails due to this error:
/bin/mkdir: cannot create directory /usr/local/include/geos: Permission Denied
It's not really a surprise, because it is trying to make a new directory in the system root folders, rather than within my personal home folder, which is the only one I have access to. I can't think of any other way around this. Am I just unable to install this library? Or can I "trick" it somehow into installing in in my home directory, where I have full admin rights?
I think You need to execute a command with root user privileges.
Because, make install command need root user privileges.
Like,
sudo make install
or with root user. Like,
sudo su
make install

How to get write permission to a /var/lib folder for app installed as a distiubutable package

I'm creating a mono app and I've build up a *.deb installer.
In windows I write quite a bit of configuration information into the program data directory. The linux corollary seems to be /var/lib/[appname]. I've figured out how to create the directories as part of the install package, but when the app goes to run I get an excpetion because the app doesn't have write permission.
How do I get my app to have write permission to the /var/lib/[appname] folder? Is that the correct place to put things like a local db for an app?
It seems the only way to do this is via the postinst script file.
You can use that hook to execute a script to chmod the directories to anything you want. You can find the complete documentation for the postinst file here: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#maintscripts

Can't run demos of Qt

I just installed Qt. I tried to run some demos but I cannot run any, this is the message:
Cannot create file /opt/QtSDK/Demos/4.7/chip/chip.pro.user: Permission
denied
To avoid this in the future, how can I set permissions to any program I install?
I'm new to using linux, I'm using Ubuntu 12.04.
Either don't install the SDK in a root-access directory, or run the program (qtcreator, etc...)with root privileges. I would choose the former solution. I generally use a folder in my home directory.
Qt SDK is standalone, so you can copy or move the whole folder to a new location which doesn't requires root privileges.

Resources