File permissions, users and linux

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
harshad1

File permissions, users and linux

Post by harshad1 »

Maybe this should be in the SW section... Anyway:

Can someone please explain how file permissions in linux work? Or give me a link to a good article that is less than 5 years old?

Here is what I want to know specifically:

Is security in linux done at the file level or at the OS level? Take my home folder - its mounted in a separate partition. Suppose I were to reinstall mint or boot into a live disk would I still have access to everything in /home (once I re-mounted it)? Suppose I reinstalled and entered a different username? Say I have abc now and I enter xyz after reinstalling. What then? Does using abc as the username again have any effect?

How about if I use gksu or sudo and execute as root on this new installation? Would I then be able to use chown to change permissions to xyz?

I ask this because I recently erased ubuntu (I broke it) and installed mint in that partition instead. I mounted the partition under /home, made the necessary entry in /etc/fstab and everything just worked. Firefox and thunderbird settings stayed etc etc.

I used the same username when installing mint though. I want to know how exactly all this works.

Someone?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
RedWagon

Re: File permissions, users and linux

Post by RedWagon »

a good article that is less than 5 years old?
For something as fundamental as users and groups in Unix even a 5 year old article can be helpful.
Can someone please explain how file permissions in linux work?
Oh, there's a lot to learn. But I can give you some basics.

First thing is usernames don't mean squat. They're just easy to read placeholders for your user id. When linux checks to see if you have permissions to do something with a file it doesn't go "hmm, john is requesting access to this file, let me see if john has access", it says "hmm, john is requesting access to this file, the user john has an ID of 1000, let me see if this file allows access to a user id of 1000." The first user account for most distros is 1000, the next is 1001 and so on and so forth. So as long as you setup your account first, you can make the username whatever you want and you still will have full access to your home folder. However, if you made an account for someone else and then set up your account, you wouldn't have access to your home partition because you would have a different user id.

This isn't always the case, since devices can be mounted in a way that changes the permissions on all the files (like how multiple people with different permissions can mount a USB stick and have full write access) but this is an area I'm not really familiar with.
Would I then be able to use chown to change permissions to xyz?
Yup, you can change ownerships of files pretty easily. It isn't something you should be doing often though because with proper group management you really shouldn't need to.
Suppose I were to reinstall mint or boot into a live disk would I still have access to everything in /home (once I re-mounted it)?
You sound a little concerned about the security of your files with a live disc. Keep in mind that with security if someone gets physical access to your machine it's game over. On consumer PCs (desktops/laptops, not servers) it's pretty much impossible to stop someone with a little bit of knowledge from being able to get control of your PC if they have physical access. The only safeguard you have against that is encrypting your home directory, but to me that seems a little paranoid for most home users.

Hopefully that answered a few of your questions, asking us to explain how file permissions, users and groups work is such a large subject it's hard to know where to start. If you have any more specific questions feel free to ask.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: File permissions, users and linux

Post by MALsPa »

Maybe these will help:

http://www.ghacks.net/2010/01/21/get-to ... rmissions/

http://www.linux.org/lessons/beginner/l ... on14a.html

http://www.tuxfiles.org/linuxhelp/filepermissions.html

Lots of other info out there, too.

I agree, stuff older than 5 years old would still be good for understanding permissions in Linux.
harshad1

Re: File permissions, users and linux

Post by harshad1 »

For something as fundamental as users and groups in Unix even a 5 year old article can be helpful.
Yeah. I know. Its just that more than once I've tried something from an old article only to find out its no longer supported / has been depreciated....
Last edited by harshad1 on Fri Jun 11, 2010 1:59 am, edited 1 time in total.
harshad1

Re: File permissions, users and linux

Post by harshad1 »

You sound a little concerned about the security of your files with a live disc.
Its actually the other way around. I've been playing around with linux a lot recently. And I've been breaking things badly enough to warrant a re-installation once in a while. I just want to make sure that I will not be locked out of my own files If I am forced to reinstall or use a live disk temporarily.

Thanks for the explanation(s). Its just what I need to get started...
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: File permissions, users and linux

Post by MALsPa »

harshad1 wrote:Yeah. I know. Its just that more than once I've tried something from an old article only to find out its no longer supported / has been depreciated....
Yeah, it happens. Also, on this subject, older articles don't talk much about doing some of the same things via GUI. It's good to understand the CLI approach, but when I do have to deal with permissions, I normally view them (and, rarely, edit them) via whatever file manager I'm using.
harshad1

Re: File permissions, users and linux

Post by harshad1 »

MALsPa wrote:Yeah, it happens. Also, on this subject, older articles don't talk much about doing some of the same things via GUI. It's good to understand the CLI approach, but when I do have to deal with permissions, I normally view them (and, rarely, edit them) via whatever file manager I'm using.
I have a feeling that nautilus is a bit broken when it comes to this. It refuses to apply changes in permissions recursively. chown -R is my only option.

I've run into several depreciated commands. Thank goodness for man files and linux's generally extensive help. :D
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: File permissions, users and linux

Post by MALsPa »

harshad1 wrote:I have a feeling that nautilus is a bit broken when it comes to this. It refuses to apply changes in permissions recursively. chown -R is my only option.
Ha! CLI trumps GUI once again! :lol:
Locked

Return to “Beginner Questions”