LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2008, 02:55 PM   #1
raj_hcl1986@rediffma
LQ Newbie
 
Registered: Oct 2008
Posts: 21

Rep: Reputation: 15
stuck in file permissions


Hi
I m new in linux and have a basic query. Hope i ll get my answer here.

I have made a file /depts/hr/ in root's home directory. Now changed its group ownership from 'root' to 'hr'. Also changed the file permissions of /depts/hr to 770.

Now I want to access this file with ls from a user 'atul' who is also a member of 'hr' group. But when i do this i m getting error- permissioned denied.

Isn't it correct that with above given permissions members of group can access the file? Then why atul is not able to?

Pls guide me.
 
Old 11-08-2008, 04:01 PM   #2
BlueC
Member
 
Registered: Aug 2007
Posts: 122

Rep: Reputation: 17
Probably because atul is not allowed access to /root and depts/hr is within /root

If you want to set up a directory that other users have access to then do not put it in /root because no other user should have access to /root

I would put the depts/hr directory in /usr/share/ and then set the permissions/ownership accordingly.
 
Old 11-08-2008, 04:06 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
Quote:
Originally Posted by raj_hcl1986@rediffma View Post
Hi
I m new in linux and have a basic query. Hope i ll get my answer here.

I have made a file /depts/hr/ in root's home directory. Now changed its group ownership from 'root' to 'hr'. Also changed the file permissions of /depts/hr to 770.
Instead of providing the straight answer, I will show you the patch to enlightenment so hopefully you learn it better

I assume that depts/hr is under /root then. Right?

In that case, try these three commands, and look carefully the ownerships and permissions for the three commands:

Code:
ls -ld /root
ls -ld /root/depts
ls -ld /root/depts/hr
All of these as root, for obvious reasons since your regular users will not be able to do so.

The hint: note that to be able to reach "hr" you need to go across all the possible locations between / and that location. If there's a wall in the middle of the road then you can't pass.
 
Old 11-08-2008, 04:46 PM   #4
raj_hcl1986@rediffma
LQ Newbie
 
Registered: Oct 2008
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks to both of you for providing valuable info. But still have doubt that if I make my file in /usr/share then it has permissions rwxr_xr_x means atul can only see the files inside but cannot create a new file. Where to make a file which is accessible to all and everyone can write.

Is /tmp OK ?
 
Old 11-08-2008, 11:26 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
Quote:
Originally Posted by raj_hcl1986@rediffma View Post
Thanks to both of you for providing valuable info. But still have doubt that if I make my file in /usr/share then it has permissions rwxr_xr_x means atul can only see the files inside but cannot create a new file. Where to make a file which is accessible to all and everyone can write.

Is /tmp OK ?
tmp is ok, but there's no reason why you can't write into a directory under /usr/local if you set it +w for your user/group. It really depends on what that file is going to contain. Note that the contents of tmp is wiped on reboots by default on some distros.

The read and exec permissions for directories are somewhat different on that matter, because to access a subdir you need to read the dirs that are before it on the tree. But to write into a dir, you don't need to write anything on the father dirs.

So, as long as you have +rx on the previous dirs, you can allow +w on a given dir and it should work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck on sript to scp a file nazs Programming 10 04-24-2007 06:19 PM
stuck after mounting file systems ashlesha Linux - Kernel 0 10-28-2006 07:16 PM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
file sharing... stuck mifan Linux - Networking 7 08-23-2005 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration