Linux - NewbieThis 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.
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.
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.)
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.