Questions tagged [chmod]

chmod is a linux/unix command. It stands for "change mode". This command is used change the permissions of directories and files.

chmod accepts either human readable notation of the octal bitwise mask. The bitwise mask often has the three digits, specifying (from left to right) permissions for the world, group and the owner of the file. The bits (left to right) are read, write, and execute. For instance,

chmod 740 x.sh

makes x.sh viewable, editable and executable for the current owner. The group can view but not change or execute, and the world has no access. This can be verified with ls -l x.sh:

-rw-r--r-- 1 me 11 2013-01-25 09:53 x.sh

Permission flags can also be specified as letters (r - read, w - write, x - execute), using + or - sign to turn them on or off, for all users. For instance

chmod +r-x x.sh

with make x.sh readable for possible users but no longer executable, even for the owner. The write permission that has not been mentioned in the command, will not be revoked form the owner:

-rw-r--r-- 1 me 11 2013-01-25 09:53 x.sh

Chmod also accepts the forth (actually first) digit that sets (left to right) setUID, setGUI and sticky flags. If not specified, it is assumed 0 (no such flags).

If chmod parameter is less than 3 digits, the first owner and then group permissions are assumed zero. The following example sets (probably in an unexpected way) full permissions for the world and no permissions for the user or group:

chmod 7 x.sh
cat x.sh
cat: x.sh: Permission denied
1322 questions
-1
votes
2 answers

Why don't developers use the `install` command?

While looking at my friend's Makefile, I noticed that he used the install shell command. From what I can tell, the command allows you to install and chmod files with one fell swoop. The command came up in a subsequent conversation of ours, and he…
dejay
  • 758
  • 2
  • 6
  • 18
-1
votes
1 answer

is there a way to chmod ugo-rw 12 different gif and jpg files within a folder without chmoding each individual one?

I need to chmod ugo-rw 12 different gif and jpg files so the python terminal can access them do I HAVE TO do that for each individual one? Is it possible to grant rw permissions to multiple files at once?
-1
votes
1 answer

chmod exclusions

I know I should assign a group and then set an umask so that groups writable permissions persist but for whatever reason I can't do this. I need to chmod recursively a directory except one sub folder (web10), would the following work? cd…
Ross Knight
  • 9
  • 1
  • 5
-1
votes
3 answers

can't edit permissions of directory after changing them using "sudo chmod 444 etc"

I'm using Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-31-virtual x86_64) and changed the permissions of the "etc" directory to 444 (sudo chmod 444 etc). I now cant change the permissions to anything else and am receiving the following message: $ sudo chmod…
Tony Nesday
  • 45
  • 1
  • 7
-1
votes
1 answer

Change the default folder permissions ubuntu

I am new to Linux, What bothers me is when i'm on my ruby on rails project and when i generate a controller or any file. If i looking into the file browser, it has a lock symbol. so, i have to do chmod 757 -R file everytime. So, is there anyway to…
Mirage
  • 1,477
  • 16
  • 28
-1
votes
1 answer

Issue with permissions on PHP, even chmod isnt working

i am having a little problem here, i am trying to upload an image but i am receiving Permission Denied error. So i added a chmod 0777 to targeted directory, but i can not use chmod either, its giving me Permission Denied too for it Anything i can do…
user1773801
  • 55
  • 2
  • 7
-1
votes
3 answers

Writing to a file PHP

I have the following code: $cachefile = "http://www.DOMAIN.com/users/{$user}.php"; $fp = fopen($cachefile, 'w'); // open the cache file "cache/home.html" for writing fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file…
Matt
  • 1,500
  • 8
  • 23
  • 38
-2
votes
2 answers

Can't execute command chmod 0777 * -R in CentOS 7

I am trying to execute command chmod 0777 * -R, but the chmod: changing permissions of ‘70-persistent-net.rules’: Operation not permitted error appears. How to solve this problem? Thanks for answer!
404
  • 13
  • 1
  • 4
-2
votes
1 answer

how to combine two commands into one

Please advise how I can combine this commands in one but I don't need install npm in /opt/app-root folder RUN chmod -R ug+rwx /opt/app-root RUN chmod -R ug+rwx /app && npm i
-2
votes
1 answer

Permission inheritance of directories in Linux

So by default my / directory is chmod 555. I ran the following to test something out: sudo chmod 777 / mkdir /dss sudo chmod 555 / # reset permissions if I run stat /dss then it shows File: ‘/dss’ Size: 6 Blocks: 0 IO…
user3613290
  • 461
  • 6
  • 18
-2
votes
1 answer

PHP running on raspberry (Debian) with Apache

I'm running PHP code with Apache on my raspberry which is a debian. My PHP files are in this folder: /var/www/html/project Sometimes my PHP scripts need to write in some files in this sub folder, but I get this error: PHP Warning: chmod():…
Wazer94
  • 1
  • 1
-2
votes
1 answer

What is wrong with chmod 0007

I have a php form that functions nicely with chmod 0007 despite the audible gasps coming from stackoverflow's direction. How to chmod 0007 a lot of directories with php? Isn't the least permission the best? What is wrong with 0007? What permission…
WerewolF
  • 39
  • 7
-2
votes
1 answer

Folders protection

I need to protect my data in my home on cluster (ssh) by others. I would like via chmod to prevent others to enter (read and write) in that directory so that I only have permissions to enter, read and write files. Which is the best "chmod"…
NewUsr_stat
  • 2,351
  • 5
  • 28
  • 38
-2
votes
1 answer

How to chmod all files in sub-directories without chmod the folders?

I have tried to chmod 444 for every HTML file in all sub-directories, but all files and folders were changed to 444 when I tried this command: chmod -R 444 /home/ppp/ *.html I just want to chmod all HTML files in /home/ppp folder and sub-folders,…
SuperBerry
  • 1,193
  • 1
  • 12
  • 28
-2
votes
2 answers

Cannot find chmod[metasploit installation]

in the picture below you can see that it says chmod command is not found yet it has chmod installed. I am installing metasploit directly from the terminal(I did not install any desktop environment and don't want to run msf from there). Is there any…
Fur
  • 81
  • 9