# permission 400

**URL:** <https://community.unix.com/t/permission-400/252184>\
**Category:** Red Hat\
**Created:** [October 27, 2009, 10:55am UTC](https://community.unix.com/t/permission-400/252184 "2009-10-27T10:55:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dplinux](https://community.unix.com/letter_avatar/dplinux/32/5_5575768a8748004e209b776fc1b2916d.png) [@dplinux](https://community.unix.com/u/dplinux)\
**Post date:** [October 27, 2009, 10:55am UTC](https://community.unix.com/t/permission-400/252184/1 "2009-10-27T10:55:03Z")

</div>

#ls -l  
-r-------- 1 root root 0 Oct 21 01:50 hello.txt  
#cat \> hello.txt  
Hello World!  
ctrl+d

#cat hello.txt  
Hello World!

How come root can still write to this file even though the file is read only..?

---

<div class="post-metadata">

**Author:** ![Scott](https://community.unix.com/letter_avatar/scott/32/5_5575768a8748004e209b776fc1b2916d.png) [@Scott](https://community.unix.com/u/Scott)\
**Post date:** [October 27, 2009, 11:38am UTC](https://community.unix.com/t/permission-400/252184/2 "2009-10-27T11:38:40Z")

</div>

To protect against it, you could set this in your profile:

```nohighlight
set -o noclobber

```

But this prevent overwriting any file with "\>" unlsess you use \>|

```nohighlight
echo Hello World >| file

```

---

<div class="post-metadata">

**Author:** ![proactiveaditya](https://community.unix.com/letter_avatar/proactiveaditya/32/5_5575768a8748004e209b776fc1b2916d.png) [@proactiveaditya](https://community.unix.com/u/proactiveaditya)\
**Post date:** [October 27, 2009, 11:41am UTC](https://community.unix.com/t/permission-400/252184/3 "2009-10-27T11:41:34Z")

</div>

```nohighlight
How come root can still write to this file even though the file is read only..?

```

---

<div class="post-metadata">

**Author:** ![Scott](https://community.unix.com/letter_avatar/scott/32/5_5575768a8748004e209b776fc1b2916d.png) [@Scott](https://community.unix.com/u/Scott)\
**Post date:** [October 27, 2009, 11:42am UTC](https://community.unix.com/t/permission-400/252184/4 "2009-10-27T11:42:44Z")

</div>

> [@proactiveaditya](#):
>
> ```plaintext
> How come root can still write to this file even though the file is read only..?
> 
> ```

Sorry. That bit got lost 😉

I meant to say:

Root can do anything!

...

---

<div class="post-metadata">

**Author:** ![mark54g](https://community.unix.com/letter_avatar/mark54g/32/5_5575768a8748004e209b776fc1b2916d.png) [@mark54g](https://community.unix.com/u/mark54g)\
**Post date:** [October 29, 2009, 12:03am UTC](https://community.unix.com/t/permission-400/252184/5 "2009-10-29T00:03:42Z")

</div>

if you really want root to do nothing to it, chattr -i

Then nobody will be able to do anything to the file to modify it until the immutable flag is removed.

---

<div class="post-metadata">

**Author:** ![\_val](https://community.unix.com/letter_avatar/_val/32/5_5575768a8748004e209b776fc1b2916d.png) [@\_val](https://community.unix.com/u/_val)\
**Post date:** [November 21, 2009, 3:00pm UTC](https://community.unix.com/t/permission-400/252184/6 "2009-11-21T15:00:22Z")

</div>

> [@mark54g](#):
>
> if you really want root to do nothing to it, chattr -i
> 
> Then nobody will be able to do anything to the file to modify it until the immutable flag is removed.

A little note. chattr which stands for (change attribute) should be defined as follows:

```plaintext
chattr +i filename

```

In this case you won't be able to remove the file(unless you change it to -i) even if your root.
