LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Security and Permissions Questions (https://www.linuxquestions.org/questions/linux-newbie-8/security-and-permissions-questions-51701/)

gauge73 03-25-2003 02:44 PM

Security and Permissions Questions
 
I have come up with a couple questions that are pretty basic that I need to have answered to further myself at all as a Linux user. I recently encountered an issue regarding permissions on my network and more specifically on my Linux server...

I have a hard drive that is mostly shared on my network at home. This drive is mounted at /mnt/network and has two subdirectories from there. One is data and the other is public. The data director is my personal files that I keep and use off of my Linux server. The public director is for general file sharing at LAN parties I host for my friends.

I wanted to share a file that was in my personal data directory by putting a link in the public directory. I did this, but only I was able to see the link in the public directory. It was invisible to all the rest of the users who were logged on the guest account (which only had access to the public directory.

Initially, the following folders and directories were owned by me and my personal group (which had no other members) with 750 permissions set...

/mnt
/mnt/network
/mnt/network/data
/mnt/network/data/software
/mnt/data/software/<the file I wanted to share>

and the following directory was given 777 permissions, and was owned by a LANparty group, which included the guest account...

/mnt/network/public (and all contents)

So, what I ended up doing was giving 775 access to all the files that were originally 750 and owned by me. This way they were able to see the link and read/execute the file over the network. This brought up the following questions for me:

1) In order to have access to a file/directory, do you have to have permissions to all the parent directories down to the root directory? Or can you access a directory if you do not have permissions on the parent directory?

2) Do all new files and directories take their permissions from their parent directory?

3) Is there a way to change default permissions when directories and files are created in a specific place?



Thanks a bunch for any help.

Tinkster 03-25-2003 03:07 PM

Quote:

Quoting gauge73
1) In order to have access to a file/directory, do you have to have permissions to all the parent directories down to the root directory? Or can you access a directory if you do not have permissions on the parent directory?
Let's say if the user doesn't have read-permission to
some or all of the directories in the tree but has access
to a single file s/he has to specify the fully qualified name
of the file to access it.

Quote:

2) Do all new files and directories take their permissions from their parent directory?
Nope, they take it from umask. Do a man umask for
more information.

Quote:

3) Is there a way to change default permissions when directories and files are created in a specific place?
[/quote]
Yes, usually you'll want to modify umask for that.
To do it temporarily you can use the utility umask,
if you want it changed permanently (bad idea, the
default is very sensible!) edit /etc/profile and go
for umask there :)

For a good overview go here

Cheers,
Tink

gauge73 03-25-2003 10:04 PM

Thanks a bunch. That pretty much answers my questions. :)

Tinkster 03-25-2003 10:15 PM

Quote:

Originally posted by gauge73
Thanks a bunch. That pretty much answers my questions. :)
Glad I could be of help! :}

Cheers,
Tink


All times are GMT -5. The time now is 11:27 AM.