Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

UNIX Permissions & Directories

Name: Anonymous 2006-04-21 16:51

Earlier I migrated my internal drives from an older file-system to ReiserFS v3 and am still learning UNIX permissions so do bare with me. I understand how permissions are broken down but ran into an issue earlier.

I had the idea of recursively setting 644 (rw-,r--,r--) to the contents of one of these drives and grant execution privileges to choice files such as shell scripts and binaries used to launch games. However, I found that none of the files or directories were accessible. The drive's root contents were listed but could not browse or access any of the files/directories deeper than this. I finally found through trial that I could open files only if their parent folder had execution privileges. My questions are whether or not this is normal and if there is any way to recursively set permissions to only directories using chmod/chown.

Any help would be appreciated, I'm in no rush.

Name: Anonymous 2006-04-21 17:26

It's normal.

man chmod, read the MODES part and you'll find the answers you seek.

Name: Anonymous 2006-04-21 17:51

Use find to find directories.
chmod a+x $(find / -type d)Something like that, or perhaps with xargs if there are too many arguments. I don't know how one uses xargs.

Name: Anonymous 2006-04-21 18:03

Thanks to the both of you. While I had the idea of using the find tool to list all of the sub-directories then piping the output into chmod, a few problems did come up but the command string you posted carries through w/o a hitch

Again, much appreciated. :)

Name: Anonymous 2006-04-21 18:31

Ah, I jumped the gun!

It seems to run into an issue dealing with paths that have spacing as the lines in the output of "find -type d" do not have quotations around them. For example, if there was a sub-directory at "/Games/Enemy Territory" chmod would interpret "Games/Enemy" and "Territory" as separate directories from the working directory. Any idea on how to remedy this?

Name: Anonymous 2006-04-21 19:40

>>5
Ah! I have encountered that a couple times ... I never found a solution. xargs(1) probably has something for that :).

Name: Anonymous 2006-04-21 20:45

find / -type d -exec chmod a+x {} \;

Name: Anonymous 2006-04-21 21:12

>>7
Seems to work. Don't suppose you could explain the "{}" bit, could you?

Name: Anonymous 2006-04-21 21:18

>>8
's just the argument from the find which is sent to the chmod.  man find, and read the bit on -exec for further clarification.

Name: Anonymous 2006-04-21 21:24

>>9
Will do, thanks again to everyone!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List