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
1 answer

Changing permission of a list of file s in a directory meeting certain conditions?

I currently have to change the permission of all the files meeting the criteria g=000 (meaning group has no reading permission, no writing permission and not execution permission) which are in a directory containing ~50 files. I'm with Linux and…
MaelPJ
  • 115
  • 5
-1
votes
2 answers

How to change the permission mode in Linux?

To grant read and write permissions to the owner and to remove execution permission from the group should it be two commands as, chmod u +rw Test chmod g -x Test or could it be can done in a single command?
-1
votes
1 answer

How to run properly chmod in OSX with C#?

I have the same problem as here How run chmod in OSX with C# I would like to change permission via code in Unity I tried : ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "chmod", Arguments = "+x " +…
eugen
  • 1
  • 2
-1
votes
1 answer

The executable permission of file after downloading is getting changed. Is there any protocol or way to intact the permission?

I have deployed a Django application on AWS EC2 and application is targeted for Linux desktop users. There are some files which get downloaded in browser when clicking some links and are meant to be run by clicking on the files. I am setting the…
bihari_gamer
  • 422
  • 5
  • 15
-1
votes
1 answer

Use chmod recursively to increase permissions for files and directories below a threshold but do not change those that are already above the threshold

I am using Linux (RHEL 7.5) and have a directory containing some files and directories that have 750 permissions (or lower), and some files and directories that have 777 permissions. I wish to increase the permissions (recursively) for those files…
0012
  • 142
  • 3
  • 9
-1
votes
1 answer

how to unset permision folder html

In my Linux machine i have html folder and projects are inside this folder.Now i can't edit my projects its locked like now i can't directly edit or delete pages.i wan to login as root .so it's very difficult for code changes.totally stuck and i…
Ezra
  • 247
  • 1
  • 13
-1
votes
1 answer

chmod 755 permissions for created files

I'm running Ubuntu Server 18.04.01 and am somewhat a noob when it comes to Linux permissions settings. I have application A which is creating files and dumping them in a directory, and application B which is then taking those files, processing them…
Catch_0x16
  • 187
  • 1
  • 4
  • 13
-1
votes
2 answers

How to create a directory with php and chmod it to 0777?

How to create a directory with php and chmod it to 0777? I have searched other stack articles related to chmod via PHP, all are file related, not directory... public function store(Document $document) { if (!isset($document->id)) {…
WerewolF
  • 39
  • 7
-1
votes
1 answer

Why does data folder in android simulator deny permission?

I tried to create database file into C:\Users\cammm\AppData\Local\Android\Sdk/platform-tools/data/data/com.cookandroid.cammm Here are steps that I tried to get into the folder click on "cmd" and run as administrator cd…
Nathan Lee
  • 75
  • 1
  • 3
  • 10
-1
votes
2 answers

Add files to c++ executable file

I am compiling a c++ file as an executable file. I am using g++ -std=c++11 your_program.cpp -o your_program to compile the program, and sudo chmod a+x your_program to create the executable file. I have 2 .txt files and a .csv file that are needed…
-1
votes
1 answer

Not able to change ownerships of a file

[vg324y@ulpv0143 ~]$ chown root hello.txt chown: changing ownership of `hello.txt': Operation not permitted [vg324y@ulpv0143 ~]$ chown ia982p hello.txt chown: changing ownership of `hello.txt': Operation not permitted [vg324y@ulpv0143 ~]$ Also,…
-1
votes
1 answer

create file with given name and permissions in linux using c

I have to write a function in c create with 2 parameters: file name and permissions for the file. (e.g: create("f","rwxr_xr_x") this function creates file f which will receive "rwxr_xr_x" permissions and will return 0)If the file already exists or…
-1
votes
1 answer

I can't seem to pass arguments with spaces in bash script

I was trying to write a script for normalizing permissions in Linux: for f in $(find . -type f); do file "$f" | grep -e "ELF 64-bit LSB executable" -e "ELF 32-bit MSB executable" > /dev/null if [ $? = 0 ]; then chmod -c…
Ahmet Sait
  • 21
  • 7
-1
votes
1 answer

Debian 9.1 Set Chmod 777 to 2 files while it is not working

I am trying to setup cryptodice, but to so the setup, I need on 2 files chmod 777! Well, those 2 files are: inc/db-conf.php and inc/driver-conf.php! So I executed this command: find /CryptoDice -type d -exec chmod 777 {} \; this should set every…
-1
votes
2 answers

Write permission of a file in unix

While assigning permissions to a file with the command: $ chmod +rwx file1.txt Why is it that read and execute permissions are assigned to everybody, but write permission is only assigned to the user?
Kavya Jain
  • 87
  • 1
  • 10