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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-26-2004, 05:05 PM
|
#1
|
Member
Registered: Aug 2003
Location: Denver, CO
Distribution: CentOS, Debian
Posts: 825
Rep:
|
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.
|
|
|
05-26-2004, 06:28 PM
|
#2
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
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.
|
|
|
05-26-2004, 06:45 PM
|
#3
|
Member
Registered: Aug 2003
Location: Denver, CO
Distribution: CentOS, Debian
Posts: 825
Original Poster
Rep:
|
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.
|
|
|
05-26-2004, 09:06 PM
|
#4
|
Member
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 09:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|