LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   directory permission (https://www.linuxquestions.org/questions/linux-newbie-8/directory-permission-550655/)

leprkhn 05-02-2007 09:57 AM

directory permission
 
i am running debian etch on a machine that dual boots with winxp. i would like to access one of my nfts partitions (the one with all the music). i tried going at it through /dev/hdb5 but realized that i had to mound it first. so i mounted it at /mnt/win ( #mount -t ntfs /dev/hdb5 /mnt/win ). when i try to access /mnt/win/Music through konqueror the icon has a little lock on it and clicking gets a "you dont have enough permissions to read" message.
so i thought i'd just copy the directory /mnt/win/Music to /home/leprkhn ( #cp -r /mnt/win/Music /home/leprkhn )
and it worked!
the directory is now also in /home/leprkhn/
except that when i try to access it i still get the "you do not have enough permissions to read" message.
how do i get proper permissions? i am the only user on the machine... and id really like to know how to do this.

thank you

lep

deroB 05-02-2007 10:14 AM

have a look and the chmod man page
Code:

man chmod
or look here for some examples:
http://www.ss64.com/bash/chmod.html

the page above has a nice "applet" that will help you decide how to chage the permissions

if you just want everyone to be able to read, write and excecute
you would type [as root since you dont have permissions yet]
Code:

chmod 777 [filename]

jay73 05-02-2007 10:38 AM

as an alternative:

cd /mnt/win
chown -R username *

leprkhn 05-02-2007 10:45 AM

excellent!
that did the trick.

#chmod -R -v 777 /home/leprkhn/Music

made it fully accessible.
i get the feeling though that fully accessible isn't a good thing.
i tried:
#chmod -Rv 444 /home/leprkhn/Music
but then JuK wouldnt play any of them....

so i want back to full.
one question though: am i correct in assuming that giving full access to a directory like that is bad form from a security standpoint?

thanks for the help

lep

jay73 05-02-2007 10:57 AM

Well, there are better decisions you could take from a security point of view. 777 means anyone can change all your files in that directory. Here is the idea:

the number has three parts: user / group /others
Each number represents the permissions :
4 =read permissions
2= write permissions
1 = execute permissions (=required to be able to access a directory, among other things).
The numbers add up to determine the set of permissions for user, group and others.
So by using 777, anyone - the user(=owner of the file(s)), the group that the user belongs to, and all others - can do pretty much as they like.

Which is why I recommended chown instead: chowning = changing the owner; if the files were owned by root before, they are now owned by the particular username associated with the command. Then you can use 755, which is safer.

rch1231 05-02-2007 01:22 PM

Try this instead of

chmod 777 <file or dir>

do

chmod 755 <file or dir>

This will set it to read write execute for owner, read execute for group and read execute for everyone else.
Here is how it works with spaces to separate the groups:

owner group everyone_else
rwx rwx rwx
421 421 421
7 7 7

rwx r-x r-x
421 4-1 4-1
7 5 5

rw- r-- r--
42- 4-- 4--
6 4 4

Does that help?

leprkhn 05-02-2007 07:30 PM

yes that helps a lot. thank you.


All times are GMT -5. The time now is 03:02 PM.