1

I run fedora 30 on my computer. As user foo, my home directory rights look like this:

[foo@localhost]$ ls -l /home/
drwx------. 41 foo  foo  4.0K Jul 12 11:23 foo
drwx------.  2 root root  16K Jul 18  2018 lost+found

When I boot from a usb drive (fedora 30 again), mount the local home partition and check ownership, this is what I get.

[liveuser@pendrive]$ cd <path/to/mounted/home>
[liveuser@pendrive]$ ls -l
drwx------. 41 liveuser liveuser 4.0K Jul 12 11:23 foo
drwx------.  2 root     root      16K Jul 18  2018 lost+found

Then as liveuser, I can access the directory foo, read and write on files with user-only rights.

The uid of: liveuser on the usb stick, and foo on the local hard drive; are both 1000. My guess is that this is the origin of the problem and both users are considered to be the same.

Is this behavior expected ? If so, how can this be fixed ?

neerby
  • 13
  • 2

1 Answers1

0

This behaviour is to be expected (Indeed as someone who uses Linux extensively its difficult to understand what you are trying to do).

You are correct that the userid maps to a number, and it is the number, not the name associated with it that the filesystem records. I guess a workarround would to be to assign foo a high userid. Normally userIDs start at 500 or 1000, so assigning one of say 3500 might help?

Of-course, if you boot from A USB this is easily defeated by becoming root and reading or chowning the files. Maybe look at home directory encryption to tie reading the files to a password?

davidgo
  • 68,623
  • 13
  • 106
  • 163
  • "its difficult to understand what you are trying to do". I am not much knowledgeable in IT and linux. With security concerns, I was wondering how to hack on my own home directory. I asked the question because I was surprised and disapointed to see how trivial it could be. I will probably turn to filesystem encryption uness an alternative "fix" is proposed. – neerby Jul 12 '19 at 11:09
  • 1
    There is no alternative fix - if you boot up from an alternative disk, you can get access to the files of other users - this is true regardless of OS. – davidgo Jul 12 '19 at 11:18