Find the answer to your Linux question:
Results 1 to 7 of 7
Alright so here's the question and I kind of need an answer pretty quickly (my boss is waiting hehe). Is there a way to change permssions on a directory and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2005
    Posts
    11

    Changing permissions


    Alright so here's the question and I kind of need an answer pretty quickly (my boss is waiting hehe). Is there a way to change permssions on a directory and all its files and subdirectories (-R?) to a specific user? I'm logged in as root.

    Ex: I have a directory called dir1 and a user named mike. How do I give read permission to mike on dir1 and all of its subdirectories and files.

    Plz help!

  2. #2
    Just Joined!
    Join Date
    Mar 2005
    Location
    Oklahoma
    Posts
    38
    Do you mean changing the owner of all the files?

    If so, it would be chown -R USER:GROUP dir/

  3. #3
    Just Joined!
    Join Date
    Apr 2005
    Posts
    11
    No owner, I just want to set the read ps for a directory called dir1 to a single user called mike. mike is not part of a group, he is alone. Is there a way to set it for a single user?

  4. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by mike_1984
    No owner, I just want to set the read ps for a directory called dir1 to a single user called mike. mike is not part of a group, he is alone. Is there a way to set it for a single user?
    mike must be part of a group - all users have a GID associated with them. Usually it's a group with the same name as the user.

    There's no way to allow a specific user to access files he doesn't own, you can set permissions at owner, group and world level. They're mutually exclusive, too, so it's possible to allow a group and the world to have access but prevent the owner from accessing files. Perverse, but possible.

  5. #5
    Just Joined!
    Join Date
    Nov 2004
    Location
    Perth, Western Australia
    Posts
    59
    if you want to give mike read only access to the folder and its contents, and no-one else (except root) can access it, do:
    Code:
    chown -R mike:mike dir1/
    chmod -R 400 dir1/
    p.s. from what i can see you have posted this topic at least 3 times, and your "waiting boss" must be asleep by now. thats bound to piss off the admins.

  6. #6
    Linux Newbie
    Join Date
    Apr 2005
    Location
    Charlottesville, VA
    Posts
    175
    Quote Originally Posted by scm
    There's no way to allow a specific user to access files he doesn't own, you can set permissions at owner, group and world level.
    Actually, you can do it with access control lists (ACL). Look at 'man setfacl', and 'man acl', especially setfacl.
    ---sxeraverx---
    Linux without a C Compiler is like eating Spaghetti with your mouth sewn shut. It just doesn't make sense.

  7. #7
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    locking topic, please dont cross post...

    http://www.linuxforums.org/forum/topic-42558.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •