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

Cannot execute any command even with root user

I accidentally execute this command on my / folder Chmod -R 600 . Now my root user have no right to execute anything even chmod How can i solve it? Thk.
paul95
  • 1
  • 1
-1
votes
2 answers

chmod(): No such file or directory

this might be a duplicate but dont know the reason why i got this error.. this code is fine when im using another laptop which the php version is 5.6 but when im using a laptop with php version 5.4 i got an error.. here is the code that im using.. …
Lion Smith
  • 647
  • 3
  • 16
  • 48
-1
votes
2 answers

Linux directory and file permissions

Lets say I have directory /a with permissions wx and file /a/b with permission x. What can I do with file b? Can I read it, write or i cannot?
-1
votes
1 answer

Which file permission to write to text files?

my PHP script writes to text.txt files such $filename = "pref.enc"; // TEXT FILE $file_content = file($filename); $x = count($file_content); $fp = fopen($filename, "w+"); $file_content[0] = "$my_station" . "\n"; $y = 0; …
Roman
  • 131
  • 2
  • 10
-1
votes
1 answer

os.chmod() is Python 2.7 only works for file?

It seems os.chmod(path, stat.S_IWSUR) only works for file. Is it a known bug? How can I chmod for a whole folder including its content?
Lillian
  • 70
  • 3
  • 11
-1
votes
2 answers

How to change file permissions on Linux?

When I clear Linux caches, I use this: echo 3 > /proc/sys/vm/drop_caches It tells me: Insufficient permissions Then I inspect the file drop_caches with: ls -l /proc/sys/vm/drop_caches and I get this: -rw-r--r-- 1 root root 0 1月 22 01:21…
叶同学
  • 801
  • 1
  • 9
  • 21
-1
votes
1 answer

.bash_profile won't open

When I run open .bash_profile a new terminal opens and Last login: Wed Nov 30 19:01:22 on ttys004 /Users/MyName/.bash_profile ; exit; ➜ ~ /Users/MyName/.bash_profile ; exit; [Process completed] My permissions are -rwxr-xr-x@ 1 MyName staff …
anon
  • 2,143
  • 3
  • 25
  • 37
-1
votes
1 answer

Change permission on /usr with a sudo chmod 644 /usr

I am a trainee programmer and I have sometimes my head in the clouds.. My collegues were messing with my professional computer with ssh connections. One of them told me that the best way to prevent it was to secure my computer. In order to do this,…
vibKe
  • 1
  • 1
  • 1
-1
votes
1 answer

Would running a certain script every minute via cron be detrimental to anything?

This gets run every minute: cd /var/www/html/[redacted] && find . -exec touch -a -m -t 200001010000.00 {} \; tac /log/[redacted] > /var/www/html/[redacted] chmod 775 -R /var/www/ chown www-data:webadmins -R /var/www/ exit 0 I feel like that's bad,…
-1
votes
1 answer

Reset Linux filesystem permissions

I just did something really dumb and I'm wondering if there's any way to reverse it. So I have an AWS EC2 server instance and I was trying to edit the php.ini in /etc. It kept telling me that I didn't have permissions to write to it, so I just…
brycejl
  • 1,411
  • 17
  • 22
-1
votes
4 answers

Possible to load non-public file from same web server?

I'm working on a web-based Flash application for a client which loads an external file from the same directory it is located in on the server. I use a URLRequest to load the file: loader.load(new URLRequest("Config.xml)); Right now the Config.xml…
user45623
  • 621
  • 4
  • 18
-1
votes
1 answer

frequent-cron: always permission denied, even after chmod 777

I've installed frequent-cron, according to the installation instructions on https://github.com/homer6/frequent-cron. I've changed /etc/init.d/frequent_service/init_script.tpl for my own needs: # This is arbitrary. Change it to whatever you'd…
RobbeM
  • 727
  • 7
  • 16
  • 36
-1
votes
1 answer

Accidentally set wrong chmod with PHP

The idiot that I am, I changed the chmod of a certain directory to 0041 while trying to create directories for each month in a year programatically - I still own the folder, but can't do anything with it. Is there any way to get rid off said folder…
Zahlii
  • 818
  • 1
  • 7
  • 17
-1
votes
1 answer

Applying chmod 755 (or other) when ftping to apache var/www/ virtual host directories?

I'm struggling to understand how to apply directory and file permissions so that files and directories created by the ftp user, via an ftp client, are browsable. In other words 755 is applied by default. I'm running Apache 2 on Ubuntu 14.04.2 LTS,…
Dave Russell
  • 141
  • 1
  • 8
-1
votes
1 answer

Applying CHMOD and zipping a file in bash

Is it better to gzip a file before or after applying chmod to it. If I apply the chmod, then gzip it, and then unzip it, will it maintain the chmod?
user2883071
  • 960
  • 1
  • 20
  • 50