LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-26-2004, 05:05 PM   #1
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
users, groups, and permissions


i have a couple questions about users and permissions.

is it possible for a user to belong to more than one group, and if so, how do I set that up? assuming my current entry in /etc/passwd is something like this:

jack:x:511:512:Jack Robbins:/home/jack:/bin/bash

511 is the UID, 512 is the GID, so can i add more than one GID?


my next question concerns file permissions. i understand that when you ls -l a file, it tells you what the current permissions are:

drwxr--r--

would be a directory with full permission to the user who owns it, and read only permission to the group and everyone else. right? now say i have a file owned by user A, and i want to allow user B (from a different group) full access to that file. is there a simple way to do that without giving everyone access and without changing the file's ownership?


and lastly, do file permissions change depending on the location of the file? for example, say i create a file as user A in my home directory, then move that file to the home directory of user B. who has permission to that file now?


i guess that's it for right now. i really appreciate any help you can give me.
 
Old 05-26-2004, 06:28 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Yes, a user can be a member of more than one group. If you're keen on editing text files, open up /etc/group and edit it. If you get dizzy looking at the fields, do man group

Essentially, you find the group you want to add the user to, then append that user's name to the end of the line (using a comma to separate other users). If you use a distribution like Red Hat, there are probably graphical tools to help you do this.

As for the other questions...
Yes, the listing you gave matches your description (a directory with r/w access and read-only access for everyone else including the group)

Since a file has both an owner and an group owner, you can play with those some to try and get your user A & user B configuration (without giving access to everyone). It would get sort of complicated to set up that situation. It's possible, but probably not what you want. The key is to create more groups. So, if you have a file or set of files you want user A and user B to have access to, then make a group, put user A and user B into it, and assign the new group to the file. A user can be a part of more than one group at a time simultaneously, meaning that both can access it.

Moving a file probably won't change it's permissions. Note: if you are copying someone else's file, or moving a file you have read/write access to, the new file might have different owner/group compared tot he original. The umask attribute might come into play as well (not sure). Another thing to consider is the directory you're placing the file in. If nobody can read the contents of the directory, it doesn't matter what the permissions on the file itself are.
 
Old 05-26-2004, 06:45 PM   #3
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Original Poster
Rep: Reputation: 33
thanks so much! i think creating a new group with user A and B in it looks like the best way to go, now that i know it's possible. i'm gonna set that up tonight.
 
Old 05-26-2004, 09:06 PM   #4
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
Quote:
drwxr--r--

would be a directory with full permission to the user who owns it, and read only permission to the group and everyone else. right?
Yes, the owner would have full permissions, and the group and world would have read permission. The gotcha here is that the group and the world would NOT be able to enter that directory. They have to have eXecute permission to be able to enter the directory at all. At minimum the permissions should be 755 for this to happen.
 
  


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
creating groups, adding users, and setting permissions bowie101 Linux - Newbie 2 11-23-2005 12:42 PM
groups and permissions g_trueblood Slackware 2 10-07-2005 04:36 AM
users/groups and permissions.... muman Linux - Newbie 2 09-21-2004 11:20 AM
Users, groups, permissions - specific task question Doctafonk Linux - General 2 04-21-2004 09:05 PM
Saving users, groups and permissions in Red Hat 9 ferrantepunto Linux - Software 2 12-03-2003 01:26 PM


All times are GMT -5. The time now is 06:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration