2014-10-10 19:41:42

by Alan Stern

[permalink] [raw]
Subject: Does the filesystem alter file permissions?

I'm getting very weird results when creating new files on ext4
filesystems (this is on a CentOS 7 system). The permissions are not
what they should be.

On the / filesystem, as superuser:

[root@server ~]# umask
0000
[root@server ~]# touch a
[root@server ~]# ls -l a
-r--r----- 1 root root 0 Oct 10 11:45 a

As a normal user:

[stern@server ~]$ umask
0000
[stern@server ~]$ touch b
[stern@server ~]$ ls -l b
-rw------- 1 stern stern 0 Oct 10 11:47 b

In /boot (which is a separate ext4 filesystem):

[root@server boot]# umask
0000
[root@server boot]# touch a
[root@server boot]# ls -l a
-r--r--r--. 1 root root 0 Oct 10 15:30 a

On a tmpfs filesystem, the permissions are -rw-rw-rw-, as expected.

What causes this sort of thing, and how can I change it?

Thanks,

Alan Stern



2014-10-10 20:18:09

by Andreas Dilger

[permalink] [raw]
Subject: Re: Does the filesystem alter file permissions?

On Oct 10, 2014, at 1:41 PM, Alan Stern <[email protected]> wrote:
> I'm getting very weird results when creating new files on ext4
> filesystems (this is on a CentOS 7 system). The permissions are not
> what they should be.
>
> On the / filesystem, as superuser:
>
> [root@server ~]# umask
> 0000
> [root@server ~]# touch a
> [root@server ~]# ls -l a
> -r--r----- 1 root root 0 Oct 10 11:45 a
>
> As a normal user:
>
> [stern@server ~]$ umask
> 0000
> [stern@server ~]$ touch b
> [stern@server ~]$ ls -l b
> -rw------- 1 stern stern 0 Oct 10 11:47 b

Do you have a default ACL set on the filesystem? Try "getfacl".

Cheers, Andreas

> In /boot (which is a separate ext4 filesystem):
>
> [root@server boot]# umask
> 0000
> [root@server boot]# touch a
> [root@server boot]# ls -l a
> -r--r--r--. 1 root root 0 Oct 10 15:30 a
>
> On a tmpfs filesystem, the permissions are -rw-rw-rw-, as expected.
>
> What causes this sort of thing, and how can I change it?
>
> Thanks,
>
> Alan Stern
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






Attachments:
signature.asc (833.00 B)
Message signed with OpenPGP using GPGMail

2014-10-10 20:35:18

by Alan Stern

[permalink] [raw]
Subject: Re: Does the filesystem alter file permissions?

On Fri, 10 Oct 2014, Andreas Dilger wrote:

> On Oct 10, 2014, at 1:41 PM, Alan Stern <[email protected]> wrote:
> > I'm getting very weird results when creating new files on ext4
> > filesystems (this is on a CentOS 7 system). The permissions are not
> > what they should be.
> >
> > On the / filesystem, as superuser:
> >
> > [root@server ~]# umask
> > 0000
> > [root@server ~]# touch a
> > [root@server ~]# ls -l a
> > -r--r----- 1 root root 0 Oct 10 11:45 a
> >
> > As a normal user:
> >
> > [stern@server ~]$ umask
> > 0000
> > [stern@server ~]$ touch b
> > [stern@server ~]$ ls -l b
> > -rw------- 1 stern stern 0 Oct 10 11:47 b
>
> Do you have a default ACL set on the filesystem? Try "getfacl".

I didn't create any, but it's possible the system installation did.
getfacl /root yields:

# file: root
# owner: root
# group: root
user::r-x
group::r-x
other::---
default:user::r-x
default:group::r-x
default:other::---

getfacl /boot yields:

# file: boot
# owner: root
# group: root
user::r-x
group::r-x
other::r-x
default:user::r-x
default:group::r-x
default:other::r-x

Would this cause the observed effect? I don't know what the default
ACLs do. Are they explained anywhere?

Alan Stern