You are not logged in.

#1 2010-02-14 10:55:35

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

basic permissions question 755 vs. 644 and Permission denied [SOLVED]

Why do directories need to have rwx for my user (the owner of the dir) to be able to enter them?  The example below is 755 and I can enter it no problem:

$ mkdir test
$ls -l
total 706544
drwxr-xr-x 2 user user      4096 Feb 14 05:51 test

If I remove the executable flag from the dir then try to enter it, I get a permission denied which I don't understand since I'm not attempting to execute anything by changing directories into it.. am I?

$ chmod 644 test
$ls -l
total 706544
drw-r--r-- 2 user user      4096 Feb 14 05:51 test
$ cd test
-bash: cd: test: Permission denied

Last edited by graysky (2010-02-14 11:05:40)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2010-02-14 11:02:22

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,383
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

That is the way of the world...  executable permissions on directories allow you to enter it, read permissions allow you to list the files in there.

Offline

#3 2010-02-14 11:03:57

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

Thanks for the rapid response.  I suspected as much but wanted to be sure.  Guess I can just enter the dir then chmod 644 * to keep the files the way I want them.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2010-02-14 11:07:59

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,383
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

Your folders should by default have 755 permissions and files created with 644 permissions.  There should be no need to chmod.

Offline

#5 2010-02-14 11:09:27

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

@Allan - what file dictates this behavior?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2010-02-14 11:14:05

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,383
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

> grep umask /etc/profile
#Set our umask
umask 022

Offline

#7 2010-02-14 11:16:12

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: basic permissions question 755 vs. 644 and Permission denied [SOLVED]

Thanks again


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB