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

Chmod for PHP web application

Im writing web application. It's have: index.php /app - of course, with .htaccess but im not talking about it /app/session - for sessions, session_save_path(/app/session) must be used on my server /app/include - index.php includes files from this…
aso
  • 1,331
  • 4
  • 14
  • 29
7
votes
1 answer

PHP : add write permission to file after move_uploaded_file()

After an image is uploaded with PHP, I want to make the image file writable in order to add a watermark to it . Here are the codes I used: if(isset($_FILES['file_poster']['tmp_name']) && $_FILES['file_poster']['tmp_name'] != '') { …
Raptor
  • 53,206
  • 45
  • 230
  • 366
7
votes
3 answers

Deploying with capistrano does ignore group setting

In my deploy-file I set the group to www-data: set :user, "root" set :group, "www-data" so when using cap:setup I expected capistrano to chown the folders with root:www-data But all folders and files are root:root. Any ideas…
PascalTurbo
  • 2,189
  • 3
  • 24
  • 41
6
votes
3 answers

How to run a perl script in localhost?

I had already installed Apache. I am using PHP for my scripting in localhost. Need to know how to run the perl script. I have installed sudo aptitude install libapache2-mod-perl2 I have created a directory name cgi-bin in my /var/www/cgi-bin there…
Rahul
  • 364
  • 3
  • 8
  • 21
6
votes
1 answer

How does chmod work for windows?

Windows file permissions are quite different from *nix permissions, so how is chmod from GnuWin coreutils implemented in windows?
Charles Ma
  • 47,141
  • 22
  • 87
  • 101
6
votes
1 answer

PHP: fileperms() values and convert these

Here is something i dont understand: A file has the permission 0644 which if i use php´s fileperms() functions returns 16804 as integer if i make a var_dump(). What/where is the relation between the two and how can i convert a, lets say 0755, into…
setcookie
  • 579
  • 1
  • 6
  • 12
6
votes
2 answers

"Permission denied" on file when running a docker container

I have a file that I can't edit but needs to run on in a docker container. Because the file doesn't have an extension, I have to use chmod for setting the file executable. But after I build the docker image from the docker file I always get a…
Niklas
  • 61
  • 1
  • 1
  • 4
6
votes
1 answer

wsl2 fail to change file permissions

I am working on wsl2 of win10: PS C:\Users\Gaowei> wsl -l -v NAME STATE VERSION * Ubuntu-20.04 Running 2 After entering wsl, I make a file of test.md: ➜ ~ ls -l test.md -rwxrwxrwx 1 gaowei gaowei 0 Aug 25 17:17…
AbstProcDo
  • 19,953
  • 19
  • 81
  • 138
6
votes
1 answer

git deploying project - file permissions - (chmod)

I'm deploying my project with git to a remote server using a post-update hook. More specifically I'm following these steps. Everything on my local copy has the right permissions, however after deploying with git push production, files that are set…
Mike Sullivan
  • 85
  • 1
  • 3
6
votes
1 answer

Chmod from IntelliJ on Windows?

I'm using PyCharm on Windows. How can I set executable bit or modify other permissions like Linux chmod? I found this only and nothing suitable in plugins but still hope there's a better solution then switching to Linux console for that purpose.
Putnik
  • 5,925
  • 7
  • 38
  • 58
6
votes
1 answer

how to change user (www-data) to root

I do not know what happens...but in my laptop, all folders and files have user www-data instead of root. in directory /desktop /music ....alll directories .. how can I change user root? I use command chown -R www-data:root / chown -R root:www-data…
alex
  • 103
  • 1
  • 1
  • 4
6
votes
1 answer

fopen(): failed to open stream: Permission denied (when path permission is 777)

[Duplicated] PHP function fopen() got permission error when all the path is with 777 permission. Server details : Centos 7 , PHP 7.1.8 , Apache 2.4.27 PHP Source Code : $myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); Error…
Root
  • 2,269
  • 5
  • 29
  • 58
6
votes
2 answers

How to make a package executable from the command line?

I want to make a python package executable from the command line. I know you can do chmod +x myfile.py where myfile.py starts with #!/usr/bin/env to make a single file executable using ./myfile.py. I also know you can do python -m mypackage to run…
ericksonla
  • 1,247
  • 3
  • 18
  • 34
6
votes
1 answer

chmod 777 -R on existing path getting chmod: -R: No such file or directory

I wanted to grant operation access using sudo chmod 777 -R on mac, I double checked the given path, and it's existing and no typos, but I still got chmod: -R: No such file or directory. Any ideas about why I'm getting this error?
RandomEli
  • 1,527
  • 5
  • 30
  • 53
6
votes
1 answer

chmod after reboot -> Permissions change

I'm working on Ubuntu 14.04 and I make chmod +x to a file, but, when I reboot the computer, the permissions change. How can I make to put chmod permanent?
PRVS
  • 1,612
  • 4
  • 38
  • 75