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
-2
votes
2 answers

Combines chmod and running script in one line not working in Bash

Having the following Bash sequence that creates a file, changes file permissions (to be executable) and run the script I want to do in one line the last 2 commands: $ touch dotfiles.sh $ chmod +x ./dotfiles.sh $ ./dotfiles Solution 1 I thought a…
jorge
  • 19
  • 1
  • 4
-2
votes
2 answers

Unable to edit file UNIX

I am trying to edit a file in vi editor - and when I try to save the changes it says READ ONLY. Even when I try to do a chmod I get an error saying I cannot do so. I have logged in Unix using a personal ID and not a service one
Nidhin_toms
  • 707
  • 4
  • 18
  • 29
-2
votes
1 answer

Don't understand why do I get a permission denied error

I have a file hello.c with "hello world" program in C. I also done the following on the shell (UNIX): $ ls > 1 $ chmod 0 1 $ cc -o hello hello.c $ chmod 400 hello $ ./hello > 1 And I got permission denied on 1. Why I didn't get the permission…
Mickey
  • 480
  • 4
  • 13
-2
votes
2 answers

How would you authorize pushes only in certain directories with Gitolite?

I have a working configuration for a symfony project: @admin = admin ku @developer = sarhan dima_syrv sarhandom a_bobkov @testers = novikov_d repo dev - master = @admin @developer @testers RW+ = @admin @developer RW+ = …
-2
votes
1 answer

Sharing NFS4 mount accesed by multiple users

I'm trying to share a NFS mount among multiple users. I can't get it to work, because I always get access denied. I can mount the shares, but I can't see the files. The export is made through Heartbeat+Pacemaker. I don't think that makes the…
Jorge Suárez de Lis
  • 565
  • 1
  • 10
  • 29
-2
votes
2 answers

Can't delete a file in PHP

I can't delete a file using unlink() and when I use fopen with the "w" tag, I get an error. The file has 777 chmod. I can use fopen() to write at the end of the file. But I can't delete anything. Can anybody help me please? Here's a sample: echo…
user1319182
  • 481
  • 12
  • 26
-3
votes
5 answers

Basic CHMOD restriction

i have an uploads folder on my website. What i want to do is restrict users from accessing like i dont want them to go to www.mysite.com/uploads/ and see the files in there and it should show forbidden, but they should be able to download via my…
Marshall Mathews
  • 347
  • 5
  • 18
-3
votes
2 answers

How to change file permissions of all files inside all sub-directories

I need to change the file permission of all files inside my public_html directory and all the sub directories therein. I have endeavored to use the following command but this only changed the file permission for the files inside the root…
Desper
  • 83
  • 2
  • 11
-3
votes
1 answer

Linux: chmod invalid mode

I've got this files in a directory ... I want to change the permissions of files which others has execution permission. These are the files which I want to change the permissions: If I try to change the permissions of these files with this…
José Carlos
  • 2,850
  • 12
  • 59
  • 95
-3
votes
1 answer

What does this permission mean?

I'm a little confused as to what this permission means. Could someone break it down for me? -rw-r--r-- 1 john john 38 Oct4 21:14 testfile And if I wanted to execute my test file I would type something like this chmod 733 testfile Does this mean only…
Sarah Chan
  • 41
  • 1
  • 6
-3
votes
1 answer

Changed /usr file permissions to 0744 with sudo chmod command

I had a brilliant idea to change my /usr file permissions to 0744 using 'sudo chmod 0744 /usr' while I was trying to install a program. So now I can't access any of my files, my home directory 'home/username' doesn't exist apparently (which isn't…
dbep
  • 647
  • 6
  • 20
-3
votes
2 answers

Ubuntu permission property

Just a question after I was surprised by this: I wanted to extend RWX permission for all groups for a folder so I wrote "chmod 777 FOLDER" command After I listed the folder it was defined as 777 but with drwxr-xr-x symbols only (not write symbols…
Vico la patate
  • 209
  • 2
  • 4
  • 12
-4
votes
1 answer

I cannot find the missing operand in chmod command. (PS: I am new to linux)

I am trying to run this command chmod +xElecrow-LCD5 But I get in return chmod: missing operand after '+xElecrow-LCD5' Try 'chmod --help' for more information I really dont know what to do. I am using Raspbian 32 bit full version. Downloaded…
Leo
  • 3
  • 2
-4
votes
3 answers

I can view my nodejs code in the browser. I want to prevent this

i can hit the url like localhost/foodbucket/app.js and see everything. I want to prevent this. var config = require('./config/config.js'); var app = require('express')(); var http = require('http').Server(app); var mysql = require('mysql'); var pool…
Zain Ul Abideen
  • 41
  • 1
  • 1
  • 5
-4
votes
3 answers

Chmod in C assigning wrong permissions

The following is my code for a method that copies a file from a path to a file to a directory provided as the destination. The copy works perfectly fine, however my chmod call assigns the wrong permissions to the copied file in the destination. If…
Govind Mohan
  • 109
  • 2
  • 7
1 2 3
88
89