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
0
votes
3 answers

PHP File Permissions... getting it "write"?

I am trying to write an install script for a system I have been working on. The script copies some default files from one location to another, and creates various folders for them. I have this bit working a treat, but the only problem is that when I…
Tisch
  • 2,598
  • 4
  • 27
  • 34
0
votes
2 answers

Can't login ubuntu after typing "chmod -R 744 /home"

Just a few days ago, I logged in my ubuntu PC as root, typed "chmod -R 744 /home", and rebooted my PC. Since then, I found that I couldn't log in my account due to permission issues. The only account I can log in is "guest". Can anyone help me so…
Brian
  • 12,145
  • 20
  • 90
  • 153
0
votes
0 answers

imagejpg() is showing image code on screen and isnt saving it

im trying to save an image on a directory with imagejpg(), but instead of saving the image on the directory, its showing the image's code on screen, something like this: ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC …
user1773801
  • 55
  • 2
  • 7
0
votes
2 answers

Can't do unlink or chmod - permissions denied

I'm trying to chmod a file to 777 permissions and then delete it using unlink in PHP. However, I'm getting permissions denied error. I'm able to change the permissions when logged in via FTP in filezilla though. How do I fix this ?
Ashesh
  • 939
  • 2
  • 11
  • 28
0
votes
4 answers

Need to change permissions on *nix system to 777

Have a folder and files as follows: Folder: drwxrwxrwx 3 me 153157 8 Aug 17 14:17 Nugget File within Nugget: ... -rw-rw-r-- 1 web web 24 Aug 17 14:17 nugget.php I need to change permissions on nugget.php to 777 as per the…
Steve
  • 1,857
  • 5
  • 32
  • 45
0
votes
2 answers

Can't chmod folder to write

In my apps (rooted devide), I want to chmod some files, folders to read and write. My code's here: String path = "/mnt/sdcard/.android_secure"; String[] chmod = { "su", "-c","chmod 777 "+path }; try { Runtime.getRuntime().exec(chmod); } catch…
Brian Nguyen
  • 465
  • 1
  • 5
  • 15
0
votes
1 answer

Can I get a callback / do I know when SQLite has created write-ahead log files? I want to chmod them

I have an elevated process and I want to make sure the SQLite files that it creates are readable by other processes. For some reason umask doesn't seem to do what I want (set permissions of sqlite file created by process). I'm using write-ahead…
Joe
  • 46,419
  • 33
  • 155
  • 245
0
votes
5 answers

Creating, moving, and deleting files in php without setting directory and file permissions to 777?

As the title suggests, I need the ability to create, move, and delete files and folders from php. If I CHMOD all directories and files to 777, everything works great, but if I do 755 then the scripts die with errors about permissions. From what…
Nate
  • 26,164
  • 34
  • 130
  • 214
0
votes
3 answers

What does the following Chmod command do?

I encountered a command on the following page. http://alblue.bandlem.com/2011/07/setting-up-google-code-with-git.html chmod go= .netrc Can't find it in the chmod man.
Apurv
  • 4,458
  • 2
  • 21
  • 31
0
votes
2 answers

How can I chmod files which are uploaded in this script?

I have a PHP script (which is listed below) which uploads an image. However, when an image is uploaded it defaults to 640 9so forbidden in a web browser), I need it to upload as 644. Has anyone got any suggestions on how to achieve this? Many…
Darren Riches
  • 149
  • 1
  • 12
0
votes
0 answers

permission issue with symbolic link on apache http server

I have the following file permissions. lrwxrwxrwx. 1 root root 37 Aug 20 14:35 xxx -> /disk2/xxx drwxrwxrwx. 3 root root 4096 Aug 18 17:55 xxx -rwxrwxrwx. 1 root root 41 Aug 18 17:55 README When accessing…
user121196
  • 30,032
  • 57
  • 148
  • 198
0
votes
1 answer

Permission denied on SBT installation

So I "installed" SBT by following directions here under the "UNIX" section by downloading the jar and creating the sbt script to run it - however instead of putting it in ~/bin/ I put it in /usr/local/sbt/. I added it to my PATH variable and when I…
adelbertc
  • 7,270
  • 11
  • 47
  • 70
0
votes
1 answer

PHP chmod function wont work

A wont work problem. I have a XHR file upload to a directory. There is a button the user presses on the site which executes php code. On that code I placed the function chmod($file_name, 0777);. Never mind the security issues, but this is not…
user1464296
0
votes
1 answer

Work with dir from www-user and from console in Mac OS x

I install Symfony and do: chmod -R 777 app/cache app/log Open from browser - all works great! When go to console and do: php app/console cache:clear and get error what i have not primission to delete file. Ok, i l'll do it with sudo: sudo php…
Anton Medvedev
  • 3,393
  • 3
  • 28
  • 40
0
votes
3 answers

Store st_mode (from stat) in a file and reuse it in chmod

i'm going crazy for this. I'm trying to write an archive library which can store and extract files. An archive file looks like this: <0,/home/user/file.txt,154,0755> file contents (154 byte) Each file is identified by an header ( <...> ), with four…
Stephen Smally
  • 66
  • 1
  • 1
  • 6