LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   using chmod on multiple files. (https://www.linuxquestions.org/questions/linux-software-2/using-chmod-on-multiple-files-716691/)

penduleum 04-03-2009 08:12 PM

using chmod on multiple files.
 
Evening.


I ame trying to change the premissions of a bunch of music files.
It seems that all my mp3īs, flac aac ect have read/write premissions...


I ame using mediatomb, but it whants only music files whit read premissions... (mediatomb the last section..)

I have tryed to do the following:

Code:

chmod -R 400 *.*
This is from the main music map (/media/music/)

Now, if i do that whit the user that must have the read rights, i get on almost evry map the following error:

cannot access: bla bla; premission denied.


When i do a chmod 707 or even 777, i dont have any errors...

If i do it this way: sudo chmod -R 400 *.* , the normal user, cant use the files... (its also logic, as sudo "takes" the file..)

What i whant, is to have a possebilety to set the premission on about 4k music files to 400, whit read and writ access to the map, anny map on the music partition, so i can expand the collection.

Futher more, if possible, i also whant that all the incomming music files (the extention does not mater) stays whit the read only rights... (this is handy, but not realy nessesary...)

i have locked around the net, and found the -R swithc. But what ever i do, i cant see to solve this litle problem :=)


thx for any help...

Tinkster 04-03-2009 09:37 PM

What is "the map"? You should still be able to do this as root (sudo)
and then just also "sudo chown -R your_user /media/music" ...

penduleum 04-04-2009 06:43 AM

Quote:

Originally Posted by Tinkster (Post 3497911)
What is "the map"? You should still be able to do this as root (sudo)
and then just also "sudo chown -R your_user /media/music" ...



the maps are all listed in music. music a disk, full of music.
So, its evrything in there..

i gona try your string, just to se what shud happen..
thx for your input..

Edit:

i have tryed the next command:

sudo chmod 400 -R myuser /media/music/music/ *.*

The *.* is for all the files and subfiles that are in the music dir.

I got the following error:

chmod: cannot access `myuser': No such file or directory

In the end, it changes the premissions to 400, and the user `myuser`cant get access to the dir `music.

If i look at a mp3 in one of the dir, it has the following rights:

-rwx---r-x

I forgot to mention that it is a Ubuntu 8.10 system..

ofcourse, if i go to the subdir, and do a chmod 400 *.*, it changes the files to the correct user, and i have still acces... but to do that in over 400 dirs......

edit:

i think that i have found the right chmod command..

I have done the following:

chmod -R a-x+X /media/music/music/


this sets all the files and subfiles to read only.

Then i have changed the premissions to rxw for mediatomb.db. Maby not smart or nessecary, but it seems that it is reading all the files, whitout problems. I dont have found anny error, regardless the extention (mp3, wav, flac ect).
I can only try it out when it is done reading the files. so, i will keep you updated.

thx for the input.


All times are GMT -5. The time now is 09:03 AM.