Difference between revisions of "Set Installed File Permissions for Linux"

From Qt Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 +
[[Category:HowTo]]
 +
 
Here is a guide to set permissions for installed files on linux.
 
Here is a guide to set permissions for installed files on linux.
  
In your .pro file, change <span class="caps">QMAKE</span>_INSTALL_FILE and <span class="caps">QMAKE</span>_INSTALL_PROGRAM to the following:
+
In your .pro file, change QMAKE_INSTALL_FILE and QMAKE_INSTALL_PROGRAM to the following:
  
where:
+
<code>QMAKE_INSTALL_FILE = install -m &lt;permission octals&amp;gt; -p -o &lt;user&amp;gt; -g &lt;group&amp;gt;<br />QMAKE_INSTALL_PROGRAM = install -m &lt;permission octals&amp;gt; -p -o &lt;user&amp;gt; -g &lt;group&amp;gt;</code>
  
* &lt;permissions octals&gt; is the standard linux permissions octals (ex: 755).
+
where:<br />* &lt;permissions octals&amp;gt; is the standard linux permissions octals (ex: 755).<br />* &lt;owner&amp;gt; is the owner of the file. This parameter can be ommited.<br />* &lt;group&amp;gt; is the group owner of the file. This parameter can also be ommited.
* &lt;owner&gt; is the owner of the file. This parameter can be ommited.
 
* &lt;group&gt; is the group owner of the file. This parameter can also be ommited.
 
  
 
Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.
 
Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.
  
Additional “install” parameters can be found here: http://linux.about.com/library/cmd/blcmdl1_install.htm
+
<code>unix {<br /> target.path = /opt/myApp<br /> INSTALLS += target
 
 
===Categories:===
 
  
* [[:Category:HowTo|HowTo]]
+
QMAKE_INSTALL_FILE = install -m 6755 -p -o root -g root<br /> QMAKE_INSTALL_PROGRAM = install -m 6755 -p -o root -g root<br />}</code>

Revision as of 10:50, 24 February 2015


Here is a guide to set permissions for installed files on linux.

In your .pro file, change QMAKE_INSTALL_FILE and QMAKE_INSTALL_PROGRAM to the following:

QMAKE_INSTALL_FILE = install -m <permission octals&gt; -p -o <user&gt; -g <group&gt;
QMAKE_INSTALL_PROGRAM = install -m <permission octals&gt; -p -o <user&gt; -g <group&gt;

where:
* <permissions octals&gt; is the standard linux permissions octals (ex: 755).
* <owner&gt; is the owner of the file. This parameter can be ommited.
* <group&gt; is the group owner of the file. This parameter can also be ommited.

Here is an example implementation. In this example, I install my binary in the folder /opt/myApp and give it permissions 6755 with root as the owner and root as the group owner.

unix {
target.path = /opt/myApp
INSTALLS += target

QMAKE_INSTALL_FILE = install -m 6755 -p -o root -g root
QMAKE_INSTALL_PROGRAM = install -m 6755 -p -o root -g root
}