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

PHP set file to read/download only

To keep things short, I'm making a very simple file uploading script. What I need to do, is take the file that was just uploaded, save it to the directory that is specified, and make the file read only/non executable. Why? Well, if somebody were to…
Pips
  • 1
  • 3
-1
votes
1 answer

403 Access Denied /public/packages/1.jpg

I am trying to access a picture I took from google, on a server running laravel. The photo is named 1.jpg. I have no problem access any of the other pictures in that directory but this one does gives me a 403 error. I have tried setting the chmod to…
Alex Pelletier
  • 4,933
  • 6
  • 34
  • 58
-1
votes
1 answer

How to locate files in a filesystem that are php files and chmod them to 655 in shell

I was told this would help me chmod directories: find . -type 'd' -exec chmod 755 {} \; that worked. But how can I find php files and chmod them to 644 recursively? is there a similar command to do that? just files ending in .php? Thanks
Richard Jones
  • 121
  • 1
  • 2
  • 10
-1
votes
1 answer

Chmod directories in filesystem

I uploaded a zip file of tons of PHP files, images, etc to my website. I unzipped it, and now all the permissions are messed up. How can I use Shell to chmod ONLY the directories to 755?
Richard Jones
  • 121
  • 1
  • 2
  • 10
-1
votes
1 answer

File not executable.make it executable forcefully

I just have downloaded gmtp source to connect android mtp device to my Ubuntu Linux 10.10. But when I enter command ./configure it says permission denied and chmod 0777 ./ configure is not making it executable. On double clicking it in nautilus I…
nikhil mehta
  • 972
  • 15
  • 30
-1
votes
1 answer

How to recover an OS after running chmod 777 / -R as root

My fingers decided to betray me and press the enter key a moment too soon, and I have managed to run chmod -R 777 / across a whole drive. I have no physical access to the device. I do however, still have a connected session where I am root and a…
-1
votes
1 answer

Recovering chmod's execute permission

This was an interview question. Let's say you revoked the execute permission of chmod binary -- i.e., you cannot run "chmod u+x chmod" because chmod doesn't have +x. Without obtaining a copy of chmod's binary file outside of the local file system,…
yawnerish
  • 25
  • 1
  • 6
-1
votes
1 answer

is it possible to read code in a php file on another server not executed output?

Default permission for files on linux server is 644, that means it is readable by everyone. I read some articles suggesting to change permission for config files to 600. Does it mean that there are some way for hacker to view code inside a php file…
-1
votes
1 answer

Accidental change of ownership of some root directories in Ubuntu 14.04

(Accidental) Action Hi, I am not very well versed in Linux but using Ubuntu for more than a year. Couple of days back I accidentally changed the ownership of my root folder while changing ownership of another non-root directory. I am not sure but as…
Maax
  • 33
  • 1
  • 8
-1
votes
4 answers

Delete a file from the server using unlink

I have a ffmpeg converter that converts videos into mp4's. After the conversion I want to delete the original video to save on file space. I tried using unlink($file_path) but it says permission denied. So far the video converts and generates a…
Paul Ledger
  • 1,125
  • 4
  • 21
  • 46
-1
votes
1 answer

how can I add chmod u+s file in the init.rc of linux

how can I add chmod u+s file in the init.rc of linux I added it as is... chmod u+s but it's not working. any other ideas?
amirelouti
  • 303
  • 1
  • 4
  • 13
-1
votes
1 answer

Linux - I ve chmoded all my server

I have made a big mistake in a wrong command and ended up chmoding 777 all my server. Result is no service want to start because of writable files. Is there a way to fix this like a default restore without loosing my database/files? PS: I m on…
user3119384
  • 329
  • 4
  • 23
-1
votes
2 answers

Will this script produce an error?

I have a test coming up, and this is one of the questions on the study guide, but I'm not sure which is the correct answer. I believe the answer is the 4th choice. Can someone confirm this? Consider the following Bash script. Which of the following…
Garbth Bobby
  • 31
  • 2
  • 7
-1
votes
1 answer

chmod don't work in Linux

I'm trying change permissions for all pastes inside a paste named "directory", with the command line 'chmod', Linux. The code that i'm using is the follow: chmod -R 777 /directory/* But it's not working. The some pastes works fine, others not. I…
bio
  • 283
  • 1
  • 3
  • 19
-1
votes
1 answer

Ubuntu Unable to change permisions on windows partition disk

I need to change permissions of files in my /media/MAVEN/Projects MAVEN is my windows disk partition. The permissions on the Projects folder are: :/media/MAVEN/Projects$ ls -la \total 340 drwxrwxrwx 1 root root 12288 Oct 6 21:31 . drwxrwxrwx 1 root…
Timothy
  • 4,198
  • 6
  • 49
  • 59