Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Semi-stupid semi-noob question about file permissions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
phil_r
Apprentice
Apprentice


Joined: 14 Mar 2006
Posts: 264
Location: Omaha, NE, USA

PostPosted: Wed May 23, 2007 4:44 pm    Post subject: Semi-stupid semi-noob question about file permissions Reply with quote

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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Wed May 23, 2007 5:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Wed May 23, 2007 5:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
phil_r
Apprentice
Apprentice


Joined: 14 Mar 2006
Posts: 264
Location: Omaha, NE, USA

PostPosted: Thu May 24, 2007 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum