View Single Post
  #6 (permalink)  
Old 07-14-2008, 07:22 PM
Canned
 
Posts: n/a
Re: mounting luks partition as normal user

David Bolt schreef:
> On Sun, 13 Jul 2008, Canned wrote:-
>
> <snip>
>
>> Thats not really what I had in my mind. I prefer to set the ownership
>> to the user itself. But thats not really what I'm asking for.

>
> What was you originally asked for was:
>
> <quote>
> I can mount both fs as normal user
> with no problem, the problem is I can't write to encrypted
> partition because root is the owner even though I've mount it as normal
> user. How can I fix that ?
> </quote>
>
> The chown/chmod commands I gave you fixes that.
>

Hmm...yes, I guess I could ask it in different way. My english is bad,
sorry for the misunderstanding.

>> I just want to know why both fs shows different ownership while I'm
>> mounted both of them as normal user.

>
> As Arthur Buse said, VFAT file systems have no knowledge of ownership.
> They are "owned" by whoever mounted the file system, unless explicitly
> overridden in /etc/fstab or the mount command.
>

Thats what I wanted to know. Why vfat can be owned by me after mounting
it and reiserfs not. Thanks for both of you.

> Reiserfs is a normal Linux file system and knows all about file
> ownership. As /mnt/lin/. is owned by root.root and the permissions don't
> allow for non-owner or non-group writing, you can't write to that file
> system as a normal user.
>
>> I thought if I use 'user' option in /etc/fstab the ownership would be
>> set automatically to the user, like my fat partition.

>
> No, it just means that a user is able to mount it. It doesn't mean that
> it becomes owned by the user that mounted it.
>

I thought I saw something about permission from man page, but now I know
I was wrong. This is really embarrassing.

>>> ls -l /mnt

>> drwxr-xr-x 5 root root 104 jul 13 00:04 lin
>> ^^^^^^^^^^
>> drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win
>> ^^^^^^^^^^^^^

>
> As I said before, use the chmod/chown commands and you can mount it as a
> user. What you'll see is something like this:
>
> davjam@playing:~> ls -la /local1
> total 25159940
> drwxrwsr-x 2 root users 116 2008-07-12 07:12 .
> drwxr-xr-x 25 root root 4096 2008-07-09 00:11 ..
> -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso
> -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso
> -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso
> -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso
> -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso
> -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso
>
> This shows the file system is owned by root.users. As my normal user I
> can read and write to it, as shown by the six ISOs owned by
> davjam.users.
>
> davjam@playing:~> su -
> Password:
> playing:~ # touch /local1/root.owned
> playing:~ # ls -la /local1
> total 25159940
> drwxrwsr-x 2 root users 133 Jul 14 00:32 .
> drwxr-xr-x 25 root root 4096 Jul 9 00:11 ..
> -rw-r--r-- 1 davjam users 4293345280 Jul 12 05:12 avis-100.iso
> -rw-r--r-- 1 davjam users 4296239104 Jul 12 07:16 avis-101.iso
> -rw-r--r-- 1 davjam users 4292425728 Jun 21 15:07 avis-96.iso
> -rw-r--r-- 1 davjam users 4292923392 Jun 21 18:28 avis-97.iso
> -rw-r--r-- 1 davjam users 4293169152 Jun 21 20:03 avis-98.iso
> -rw-r--r-- 1 davjam users 4295663616 Jul 12 01:33 avis-99.iso
> -rw-r--r-- 1 root users 0 Jul 14 00:32 root.owned
>
> Okay, here I've become root and created a file on the file system as
> root.
>
> playing:~ # df /local1
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/sdc2 72241144 25164192 47076952 35% /local1
>
> And I forgot to show that /local1 was a separate file system, XFS if
> you're curious.
>
> playing:~ # logout
> davjam@playing:~> touch /local1/davjam.owned
> davjam@playing:~> ls -la /local1
> total 25159940
> drwxrwsr-x 2 root users 152 2008-07-14 00:33 .
> drwxr-xr-x 25 root root 4096 2008-07-09 00:11 ..
> -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso
> -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso
> -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso
> -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso
> -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso
> -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso
> -rw-r--r-- 1 davjam users 0 2008-07-14 00:33 davjam.owned
> -rw-r--r-- 1 root users 0 2008-07-14 00:32 root.owned
>
> And, as a normal user, I created another file just to show it could be
> done.
>
> Now, if you're certain that you want the file system to be owned by
> yourself and that at no point are you going to be adding another user
> that might want to have read/write access to that file system, you can
> use virtually the same chown/chmod commands to do so. Just use this
> instead:
>
> chown snorzzz.users /mnt/lin
> chmod 755 /mnt/lin
>
> and when you do an 'ls -l /mnt' you'll see something like this:
>
> drwxr-xr-x 5 snorzzz users 104 jul 13 00:04 lin
> drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win
>

yes, thats what I did.
>
> Regards,
> David Bolt
>

Reply With Quote