{"id":8579,"date":"2014-10-28T16:45:03","date_gmt":"2014-10-28T16:45:03","guid":{"rendered":"https:\/\/wp.okra.host\/article\/permissions-overview\/"},"modified":"2021-03-07T14:30:50","modified_gmt":"2021-03-07T13:30:50","slug":"permissions-overview","status":"publish","type":"ht_kb","link":"https:\/\/kb.okra.host\/de\/article\/permissions-overview\/","title":{"rendered":"Eine \u00dcbersicht \u00fcber Berechtigungen"},"content":{"rendered":"<p>Every file is made up of a permission set. These permissions consists of\u00a03 sets of 3 bits for a total of 27 configurations. <em>Just kidding!<\/em>\u00a0It&#8217;s not that complex!<\/p>\n<figure class=\"permissions\" style=\"width: 400px\">\n<div class=\"terminal\">\n<div class=\"indicators\"><\/div>\n<div class=\"terminal-text\"><code>-r--r--r-- \u00a0 \u00a0root \u00a0 root 1972 Oct 13 23:14 test.mail<br \/>\n-rw-r--r-- \u00a0 admin \u00a0admin 4345 Aug 29 12:33 test.php<br \/>\n-rwxr-xr-x \u00a0nobody \u00a0admin\u00a0 592 Sep 25 10:20 test.py<br \/>\ndrwxrwxrwx \u00a0 admin nobody\u00a04096 Jul \u00a09 10:28 tmp<br \/>\n<\/code><\/div>\n<\/div>\n<\/figure>\n<p>Let&#8217;s take a look at output from a <a title=\"Accessing FTP server\" href=\"https:\/\/kb.okra.host\/ftp\/accessing-ftp-server\/#recommended\">FTP client<\/a>. Three files and 1 directory exist in this example. A directory, tmp\/, denoted by &#8220;<strong>d<\/strong>&#8221; is also called a folder: a place to stash files. Each file has different permission sets, which permit different interactions.<\/p>\n<h2 id=\"permissions\" >Permissions<\/h2>\n<p>Permissions are broken into chunks that consist of read (r), write (w), and execute (x) properties. <em>Read<\/em> permits access to read file or folder contents, <em>write<\/em> permits access to modify the file or remove files within a directory, and\u00a0<em>execute<\/em> allows the file to run as a program\u00a0or to open a directory. An absence of a permission is replaced by &#8220;-&#8220;.<\/p>\n<blockquote>\n<p><span style=\"color: #000080\"><strong>Note:<\/strong><\/span>\u00a0a directory could have just execute (x), lack read (r), and still be accessible by a user. File contents\u00a0could not be listed, but if the filename were known, then it could be opened. This approach is recommended\u00a0in multi-user accounts\u00a0to protect against file snooping.<\/p>\n<p><em>Likewise<\/em>, if a directory lacks an execute bit (x), then neither it nor any directories within it may be opened.<\/p>\n<\/blockquote>\n<p>Each file or directory consists of 3 chunks that are applied to the file <em>owner<\/em>, <em>group<\/em>, and everyone else (simply called &#8220;<em>other<\/em>&#8220;). Notice how each file has two users next to it?<\/p>\n<figure class=\"permissions\" style=\"height: 50px;min-width: 372px\">\n<div class=\"terminal-text\"><code>-rw-r--r-- \u00a0 \u00a0<b style=\"color: black\">admin admin<\/b>\u00a04345\u00a0Aug 29 12:33 test.php<\/code><\/div>\n<\/figure>\n<p>These 2 fields represent the <em>owner<\/em> and\u00a0<em>group<\/em> to which the file belongs. Owner is the user who created the file, and group is the group to which the user belongs. &#8220;Everyone else&#8221; is everyone else who isn&#8217;t the owner nor a member of the\u00a0group, in particular the web server that runs as user &#8220;apache&#8221; in its own group. Only user <em>admin<\/em> can write to the file. Other users created via <strong>Users<\/strong> &gt; <strong>Add\u00a0User\u00a0<\/strong>can read the file, as can the web server, in addition to the creator, <em>admin<\/em>.<\/p>\n<blockquote>\n<p>Any file created by a user on your account will\u00a0possess the same group, which is the primary username of the account. A special user &#8220;apache&#8221; is any file\u00a0created by a web application. Permissions are applied nightly to permit\u00a0modification by\u00a0the primary user on the account. Ownership can be changed via <strong>Files<\/strong> &gt; <strong>File Manager<\/strong> &gt; <strong>Properties<\/strong> action within the control panel.<\/p>\n<\/blockquote>\n<p>Permissions must be changed to allow another user, like a PHP application, write access to the file. But before that, take a quick aside to learn about the alternative form of presenting permissions&#8230;<\/p>\n<h2 id=\"octal-conversion\" >Octal Conversion<\/h2>\n<p>Permissions can be presented in set or octal form. Previously permissions were presented as sets for easy understanding. Now, map each permission type: [r,w,x] into a number: [4, 2, 1]. Add these numbers up for each permission chunk and you get a 3-digit number between 0 and 7 that represents permissions for the\u00a0<em>owner<\/em>,\u00a0<em>group<\/em>, and <i>other<\/i>.<\/p>\n<p><code>-rw----r--<\/code> becomes 604, <code>drwxr-xr-x<\/code> becomes 755, and so on. Whenever permissions are referred to as &#8220;777&#8221;, this maps to <code>-rwxrwxrwx<\/code>.<\/p>\n<table style=\"width: 230px;float: left;margin: 1em\" border=\"0\">\n<thead>\n<tr>\n<th style=\"text-align: center\" colspan=\"9\">604 Conversion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center\" colspan=\"3\">owner<\/td>\n<td style=\"text-align: center\" colspan=\"3\">group<\/td>\n<td style=\"text-align: center\" colspan=\"3\">other<\/td>\n<\/tr>\n<tr>\n<td>r<\/td>\n<td>w<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>r<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>2<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>4<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"3\">6<\/td>\n<td style=\"text-align: center\" colspan=\"3\">0<\/td>\n<td style=\"text-align: center\" colspan=\"3\">4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table style=\"width: 230px;float: left;margin: 1em;margin-left: 0\" border=\"0\">\n<thead>\n<tr>\n<th style=\"text-align: center\" colspan=\"9\">755 Conversion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center\" colspan=\"3\">owner<\/td>\n<td style=\"text-align: center\" colspan=\"3\">group<\/td>\n<td style=\"text-align: center\" colspan=\"3\">other<\/td>\n<\/tr>\n<tr>\n<td>r<\/td>\n<td>w<\/td>\n<td>x<\/td>\n<td>r<\/td>\n<td>&#8211;<\/td>\n<td>x<\/td>\n<td>r<\/td>\n<td>&#8211;<\/td>\n<td>x<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"3\">7<\/td>\n<td style=\"text-align: center\" colspan=\"3\">5<\/td>\n<td style=\"text-align: center\" colspan=\"3\">5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"clearfix\"><\/div>\n<p>Permissions from now on will be referred to in octal for brevity.<\/p>\n<h2 id=\"changing\" id=\"changing-permissions\" >Changing Permissions<\/h2>\n<p>Permissions may be edited in a variety of ways:<\/p>\n<ul>\n<li>FTP client. See <a title=\"Accessing FTP server\" href=\"https:\/\/kb.okra.host\/ftp\/accessing-ftp-server\/\">FTP access<\/a>\u00a0KB article\u00a0for details<\/li>\n<li>Web-accessible FTP client via <a href=\"http:\/\/ftp.apnscp.com\">ftp.apnscp.com<\/a>. Select <em>chmod<\/em> operation.<\/li>\n<li>Within the control panel: <strong>Files<\/strong> &gt; <strong>File Manager<\/strong> &gt; <strong>Properties<\/strong> action<\/li>\n<li><a title=\"Accessing terminal\" href=\"https:\/\/kb.okra.host\/terminal\/accessing-terminal\/\">Terminal<\/a>: <a title=\"Linux manual: chmod\" href=\"http:\/\/apnscp.com\/linux-man\/man1\/chmod.1.html\">chmod<\/a><\/li>\n<\/ul>\n<p>Permissions may be applied to a single file or directory, or recursively to all files and directories within a directory. Files created after changes are applied will not inherit these new permissions and must be reapplied as necessary.<\/p>\n<h2 id=\"777-permission\" >777 Permission<\/h2>\n<p>777 is a simple way to allow every user access to modify, create, and delete files. Often 777 is recommended to allow a PHP application access to create files. Yes, it does work and on Okra Host&#8217; hosting platform is quite secure (PHP undergoes a separate round of security checkpoints), but other users on your account also have access to read, modify, and delete files. It is, therefore,\u00a0<strong>recommended to specify 717 instead of 777 <\/strong>to lockout other users on your account from making adjustments to files. PHP applications will still be able to write to those files &#8211; <em>and only those files<\/em> &#8211; explicitly granted by\u00a0717 permissions.<\/p>\n<h2 id=\"why\" id=\"why-use-multiple-users\" >Why use multiple users?<\/h2>\n<p>Computing power has grown exponentially over the last decade; the cost to crawl a web site and brute-force has decreased.\u00a0Along with the growth of knowledge, attackers have become more sophisticated carrying out attacks through <a href=\"http:\/\/en.wikipedia.org\/wiki\/Botnet\">elaborate botnets<\/a> consisting of several hundred thousand machines. Common exploitable vectors include weak FTP passwords for other users on your account as well as outdated web applications. These vectors are continuously accessed by unauthorized users throughout the day from thousands of IP addresses\u00a0that slip below detection thresholds. Such attacks are orchestrated from a single command-and-control sever\u00a0that command infected machines to periodically try a login\/password combination.<\/p>\n<p>A single machine may probe a site <strong>2-5 times per hour<\/strong> (once every 12 minutes). Multiplied out by <strong>10,000<\/strong> different machines in a botnet, <strong>1,200,000<\/strong> combinations per day is enough to try\u00a0every possible 4-letter password combination consisting of lowercase letters and numbers 0-9 in <strong><em>only 1 day<\/em><\/strong>\u00a0or test\u00a0<a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvekey.cgi?keyword=wordpress\">every known WordPress exploit<\/a>\u00a0against\u00a065 different sites each day.<\/p>\n<ol>\n<li style=\"text-align: left\">Attacks do happen, and the level of sophistication is much greater than a decade ago.<\/li>\n<li style=\"text-align: left\">Use separate users to restrict the impact of an unauthorized breach.<\/li>\n<li style=\"text-align: left\">Judiciously apply permissions to only those files that the web server or other users must have access to modify.<\/li>\n<\/ol>\n<p style=\"text-align: center\"><em>Reduce your risk and impact\u00a0by utilizing multiple users.<\/em><\/p>\n<h2 style=\"text-align: left\" id=\"see-also\" >See Also<\/h2>\n<ul>\n<li><a title=\"Writing to files\" href=\"https:\/\/kb.okra.host\/php\/writing-to-files\/\">PHP: Writing to files<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Every file is made up of a permission set. These permissions consists of\u00a03 sets of 3 bits for a total of 27 configurations. Just kidding!\u00a0It&#8217;s not that complex! -r&#8211;r&#8211;r&#8211; \u00a0 \u00a0root \u00a0 root 1972 Oct 13 23:14 test.mail -rw-r&#8211;r&#8211; \u00a0 admin \u00a0admin 4345 Aug 29 12:33 test.php -rwxr-xr-x \u00a0nobody \u00a0admin\u00a0&#8230;<\/p>","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[60],"ht-kb-tag":[],"class_list":["post-8579","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-guides"],"_links":{"self":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/comments?post=8579"}],"version-history":[{"count":1,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8579\/revisions"}],"predecessor-version":[{"id":8580,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8579\/revisions\/8580"}],"wp:attachment":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/media?parent=8579"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb-category?post=8579"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb-tag?post=8579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}