Subject: File permissions in ext4

Hello,

I am attempting to read the file permissions from a file in EXT4, but
I'm not sure where it is stored? Any ideas?

I thought this would be the ACL, and I read both
ext4_inode.i_file_acl_lo and ext4_inode.l_i_file_acl_high and they are
both zero, despite the fact that the file has 644 permission set. Is
the ACL actually used for anything?

thanks in advance =)
--
Felipe Monteiro de Carvalho


Subject: Re: File permissions in ext4

Hello,

Ok, I found that the permissions that I was looking for are stored in
ext4_inode.i_mode ... but still there is the question: What is ACL
used for then, and when is it different than zero?

thanks =)
--
Felipe Monteiro de Carvalho

2013-08-01 12:59:52

by Viacheslav Dubeyko

[permalink] [raw]
Subject: Re: File permissions in ext4

On Thu, 2013-08-01 at 14:34 +0200, Felipe Monteiro de Carvalho wrote:
> Hello,
>
> Ok, I found that the permissions that I was looking for are stored in
> ext4_inode.i_mode ... but still there is the question: What is ACL
> used for then, and when is it different than zero?
>

Do you build the kernel with POSIX ACLs support
(CONFIG_EXT4_FS_POSIX_ACL)?

With the best regards,
Vyacheslav Dubeyko.



Subject: Re: File permissions in ext4

On Thu, Aug 1, 2013 at 2:59 PM, Vyacheslav Dubeyko <[email protected]> wrote:
> Do you build the kernel with POSIX ACLs support
> (CONFIG_EXT4_FS_POSIX_ACL)?

Anyway to find out this? I am using the pre-compiled kernel which
comes with Mageia Linux ... so I did not compile the kernel myself.

--
Felipe Monteiro de Carvalho

Subject: Re: File permissions in ext4

On Thu, Aug 1, 2013 at 3:09 PM, Felipe Monteiro de Carvalho
<[email protected]> wrote:
> On Thu, Aug 1, 2013 at 2:59 PM, Vyacheslav Dubeyko <[email protected]> wrote:
>> Do you build the kernel with POSIX ACLs support
>> (CONFIG_EXT4_FS_POSIX_ACL)?
>
> Anyway to find out this? I am using the pre-compiled kernel which
> comes with Mageia Linux ... so I did not compile the kernel myself.

But anyway, I have my own code for reading the file system which I am
running in Mac OS X/Linux/Windows ... so I wonder what difference it
would make the kernel... maybe it is about the kernel at the time when
the partition was created?

--
Felipe Monteiro de Carvalho

2013-08-01 13:21:47

by Viacheslav Dubeyko

[permalink] [raw]
Subject: Re: File permissions in ext4

On Thu, 2013-08-01 at 15:09 +0200, Felipe Monteiro de Carvalho wrote:
> On Thu, Aug 1, 2013 at 2:59 PM, Vyacheslav Dubeyko <[email protected]> wrote:
> > Do you build the kernel with POSIX ACLs support
> > (CONFIG_EXT4_FS_POSIX_ACL)?
>
> Anyway to find out this? I am using the pre-compiled kernel which
> comes with Mageia Linux ... so I did not compile the kernel myself.
>

You can check it in your kernel configuration file. Ubuntu stores such
files in /boot/config-<kernel-version>.

Anyway, I think that this quotation from fs/ext4/Kconfig can be helpful
for you:

config EXT4_FS_POSIX_ACL
bool "Ext4 POSIX Access Control Lists"
depends on EXT4_FS
select FS_POSIX_ACL
help
POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme.

To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.

If you don't know what Access Control Lists are, say N

With the best regards,
Vyacheslav Dubeyko.



Subject: Re: File permissions in ext4

On Thu, Aug 1, 2013 at 3:21 PM, Vyacheslav Dubeyko <[email protected]> wrote:
> config EXT4_FS_POSIX_ACL
> POSIX Access Control Lists (ACLs) support permissions for users and
> groups beyond the owner/group/world scheme.
>
> To learn more about Access Control Lists, visit the POSIX ACLs for
> Linux website <http://acl.bestbits.at/>.

Aha, so it is just a more advanced version of the permissions. But I
suppose that i_mode will always be valid even if the file system also
support ACL, correct?

--
Felipe Monteiro de Carvalho

2013-08-01 13:35:17

by Viacheslav Dubeyko

[permalink] [raw]
Subject: Re: File permissions in ext4

On Thu, 2013-08-01 at 15:23 +0200, Felipe Monteiro de Carvalho wrote:
> On Thu, Aug 1, 2013 at 3:21 PM, Vyacheslav Dubeyko <[email protected]> wrote:
> > config EXT4_FS_POSIX_ACL
> > POSIX Access Control Lists (ACLs) support permissions for users and
> > groups beyond the owner/group/world scheme.
> >
> > To learn more about Access Control Lists, visit the POSIX ACLs for
> > Linux website <http://acl.bestbits.at/>.
>
> Aha, so it is just a more advanced version of the permissions. But I
> suppose that i_mode will always be valid even if the file system also
> support ACL, correct?
>

As I understand, yes. Because ACLs are simply enhancement of permission
model.

With the best regards,
Vyacheslav Dubeyko.



2013-08-01 17:27:59

by Eric Sandeen

[permalink] [raw]
Subject: Re: File permissions in ext4

On 8/1/13 7:34 AM, Felipe Monteiro de Carvalho wrote:
> Hello,
>
> Ok, I found that the permissions that I was looking for are stored in
> ext4_inode.i_mode ... but still there is the question: What is ACL
> used for then, and when is it different than zero?
>
> thanks =)
>

It is the block number containing an extended attribute for that inode,
if any; that extended attribute may be a file ACL.

It's a bit odd to call the xattr block "ACL" but it is what it is. ;)

-Eric