{"id":806,"date":"2015-02-27T12:22:50","date_gmt":"2015-02-27T19:22:50","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=806"},"modified":"2015-02-27T12:22:50","modified_gmt":"2015-02-27T19:22:50","slug":"setting-permissions-via-ssh","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2015\/02\/27\/setting-permissions-via-ssh\/","title":{"rendered":"Setting permissions via SSH"},"content":{"rendered":"<p class=\"line874\">This page contains instructions on how to change the permissions of your files via a common SSH client &#8211; Putty.<span id=\"line-9\" class=\"anchor\"><\/span><span id=\"line-10\" class=\"anchor\"><\/span><\/p>\n<h3 id=\"head-1dfd99d16a521474df85074fa8654b1142a281b4\">Why would you want to change file permissions?<\/h3>\n<p class=\"line874\">Permissions are needed to protect files, and to tell the server how to handle these files. If a file does not have the correct permissions, your script may not run, or anyone may be able to access your files and make unwanted changes.<span id=\"line-13\" class=\"anchor\"><\/span><span id=\"line-14\" class=\"anchor\"><\/span><\/p>\n<h3 id=\"head-a1822cacd1cf7d5dbedc485ba9282d4ac751db3c\">Changing the permissions<\/h3>\n<p class=\"line874\">To change the permissions of a file in SSH, once you have logged in you can use the CHMOD command. Some common examples of CHMOD:<span id=\"line-17\" class=\"anchor\"><\/span><span id=\"line-18\" class=\"anchor\"><\/span><\/p>\n<p class=\"line874\">chmod number filename <span id=\"line-19\" class=\"anchor\"><\/span><span id=\"line-20\" class=\"anchor\"><\/span><\/p>\n<pre>chmod 600 example.html - This will give the file read and write permissions by the owner only (-rw-------).\nchmod 644 example.html - This will give the file read and write permissions by the owner and read by everyone else (-rw-r--r--).\nchmod 700 example.html - This will give the file read, write and execute permissions by the owner only (-rwx------).\nchmod 755 example.html - This will give the file read, write and execute permissions by the owner, read and execute permissions by the group and others (-rwxr-xr-x)\nchmod 666 example.html - This will give the file read and write permissions by everyone(-rw-rw-rw-) (NOT RECOMMENDED)\nchmod 777 example.html - This will give the file read, write and execute permissions by everyone (-rwxrwxrwx) (NOT RECOMMENDED)<\/pre>\n<h3 id=\"head-cd4b3bc8d6be7ec6ccd242b1d4f60d747e0479a8\">Changing the ownership<\/h3>\n<p class=\"line874\">To change the ownership of a file in SSH, you can use the CHOWN command. e.g:<span id=\"line-33\" class=\"anchor\"><\/span><span id=\"line-34\" class=\"anchor\"><\/span><\/p>\n<p class=\"line874\">chown owner filename<span id=\"line-35\" class=\"anchor\"><\/span><span id=\"line-36\" class=\"anchor\"><\/span><\/p>\n<pre>chown user example.html<\/pre>\n<p class=\"line874\">This will change the owner of the file to be whoever you specify in the command. You can change the owner of a file if you are the root user, or the owner of the file.<span id=\"line-41\" class=\"anchor\"><\/span><span id=\"line-42\" class=\"anchor\"><\/span><\/p>\n<p class=\"line874\">Further information on selecting the correct permissions can be found at the following link:<span id=\"line-43\" class=\"anchor\"><\/span><span id=\"line-44\" class=\"anchor\"><\/span><\/p>\n<p class=\"line867\"><a class=\"http\" href=\"http:\/\/www.anchor.com.au\/hosting\/support\/Publishing_your_website\">http:\/\/www.anchor.com.au\/hosting\/support\/Publishing_your_website<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This page contains instructions on how to change the permissions of your files via a common SSH client &#8211; Putty. Why would you want to&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-806","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=806"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/806\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}