View previous topic :: View next topic |
Author |
Message |
phil_r Apprentice
Joined: 14 Mar 2006 Posts: 264 Location: Omaha, NE, USA
|
Posted: Wed May 23, 2007 4:44 pm Post subject: Semi-stupid semi-noob question about file permissions |
|
|
Should a file - such as mp3, jpg, txt file - have the execute bit set? I'm talking strictly user data files, not system libraries etc. Should I chmod 0755 or chmod 0644... ?
Phil. _________________ Just when you think you know the answers, I change the questions. |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Wed May 23, 2007 5:09 pm Post subject: |
|
|
the execute bit should be set for
- directories (need execute to list directory contents)
- executable files such as shell scripts and binary programs
it certainly doesn't apply to mp3s and other media, but often they come off the web with such permissions set. _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Wed May 23, 2007 5:39 pm Post subject: |
|
|
You can use the find command to fix these wholesale. I think you want to chmod a-x to remove all executable permissions. To find the offending files try something like: Code: | $ find /some/dir -executable -type f |
this will find all standard files under /some/dir that are executable. If some of those files are supposed to be executable, you can narrow the search with something like: Code: | $ find /some/dir -executable -type f -name "*.mp3" |
Or you can get fancy and search for several different extensions: Code: | $ find /some/dir -executable -type f -iregex '.*\.\(mp3\|jpg\)' |
Once you get a list of files that you want to fix, you can either have find fix the files directly: Code: | $ find /some/dir -executable -type f -name "*.mp3" -exec chmod a-x '{}' \; |
or you can pipe the output of the find command through xargs: Code: | $ find /some/dir -executable -type f -name "*.mp3" | xargs chmod a-x |
|
|
Back to top |
|
|
phil_r Apprentice
Joined: 14 Mar 2006 Posts: 264 Location: Omaha, NE, USA
|
Posted: Thu May 24, 2007 11:07 am Post subject: |
|
|
Thanks guys. On a similar thread I posted last week, Paul Bredbury gave me the commands for hitting all the files with a chmod and not screwing the directories.... I just needed to make sure I was using the right permissions!!!
Unless some very mis-behaving app has installed libraries in ~ , then everything in there is pure data. I thought it didn't make sense for files to be executable, just thought I'd check though
Phil. _________________ Just when you think you know the answers, I change the questions. |
|
Back to top |
|
|
|