LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-06-2005, 08:24 AM   #1
harisund
Member
 
Registered: Sep 2005
Location: Baton Rouge
Distribution: Ubuntu 5.10
Posts: 74

Rep: Reputation: 15
What are users and what are groups?


Could someone point out some good tutorial on the entire concepts of users and groups? Well, I understand users for the most part..

The thing is, I have an old machine that hosts all my data and is my file / web / ssh server. I copied all the data into it from my Windows Machine, but I was logged in as root and the owner / group of those files says root (as in ls -l)

I was actually planning on creating a new user called data or something which I would use to log in whenever I need to access my files.

I created this user using adduser and copied all the files into /home/data (that got automatically created.) However, how do I change the user of all files (we are talking about a huge number of files and a big tree of nested directories.)

Also what is a group, anyway ?

Thanks a lot !

Hari
 
Old 12-06-2005, 08:39 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I group is a collection of users.

Each users has a primary group, and can have supplemental groups, that it belongs too. When you create a file with a user it is owned by that user and the gid of the file is set to the users primary group.

There are a bunch of utilities for changing the group, owner, and permissions of a file.

chgrp <group name> <file name> - Changes the owning group of the file.
chown <user name>:<group name-optional> <file name> - Changes the owning user and optionally the owning group of a file.
chmod <perms> <file name> - Changes the permissions associated with a file.

At a basic level users and groups are all done for the sake of access permissions to a file. Each file has permission for what the owner can do with them, what members of the owning group can do with them, and what everyone else can do with them. This way you can have a file that a subset of users can read, write, or execute without having to allow everyone on the system access to read, write, or execute it.


For more information check out the man pages for chmod, chgrp, and chown.

Also check out this article from tldp.org on File Access Permissions.
 
Old 12-06-2005, 08:51 AM   #3
tuxrules
Senior Member
 
Registered: Jun 2004
Location: Chicago
Distribution: Slackware64 -current
Posts: 1,158

Rep: Reputation: 62
Well in essence, Linux has three level of permissions. User, group and world. Within each level you have three basic types of file permissions, read(r), write(w) and execute(x). Files can be read, written and executed by user, group members or world(everyone) based on the file permissions.

Groups are nothing but normal groups (like in real life) having user membership. You can belong to any number of groups but you have belong to atleast 1 group. The groups work exactly like the way a real life group would work. e.g. like you would want to give your friends the right view your class notes.

Say you have a group called "data" as well. Files are generally owned by a particular user (in your case "data") and it is also accessible to other users who belong to the group "data". This is just a quick overview...but you can find more detailed explanations on the web. I suggest you look at www.google.com/linux

You should also look at chown and chmod commands.
 
Old 12-06-2005, 08:56 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Most users can ignore users and groups---it is there for big multi-user systems--where you wnat to assign priveleges to a certain type of user.

To change everything in a folder, go up one directory (so you see your folder in "ls". Then (as root), type:
chown -R username:username dirname

or chmod -R xxx dirname to change all the permissions
 
Old 12-06-2005, 09:52 AM   #5
harisund
Member
 
Registered: Sep 2005
Location: Baton Rouge
Distribution: Ubuntu 5.10
Posts: 74

Original Poster
Rep: Reputation: 15
Thanks everyone !

That really helps.

I will look into chown and chgrp.

Thanks again !

Hari
 
Old 12-06-2005, 12:33 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Note the -R (recursive) option of these commands.

Also note that, with chown, you can change both the "owner" and the "group" of the files and directories at the same time.

Be aware of the subtle difference in how permissions, such as 'r'ead and e'x'ecute, apply to directories.

Also be aware that some filesystems, like VFAT, do not support the notion of owners, groups, and permissions.
 
  


Reply



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
groups and users twb2005 Linux - Newbie 7 10-10-2005 06:21 PM
users and groups twb2005 Linux From Scratch 2 10-10-2005 01:47 PM
users and groups twb2005 Red Hat 1 10-10-2005 01:47 PM
users and groups Red Squirrel Linux - Newbie 2 02-22-2004 07:37 PM
users and groups krfulton Linux - Security 1 01-05-2004 03:43 AM

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

All times are GMT -5. The time now is 03:59 AM.

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