# Bizarre log file permissions

**URL:** <https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216>\
**Category:** Rails\
**Created:** [October 24, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216 "2007-10-24T21:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 24, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216/1 "2007-10-24T21:31:05Z")

</div>

When I create a new app with the rails command, it creates a log  
directory. You must chmod that to 666 according to the error message I  
get whenever anything (like script/generate) tries to log a message.  
Fine …

… But, what the hell is this about???

$ ls -la log/  
ls: cannot access log/.: Permission denied  
ls: cannot access log/…: Permission denied  
ls: cannot access log/development.log: Permission denied  
ls: cannot access log/test.log: Permission denied  
ls: cannot access log/server.log: Permission denied  
ls: cannot access log/production.log: Permission denied  
total 0  
??? ? ? ? ? ? .  
??? ? ? ? ? ? …  
??? ? ? ? ? ? development.log  
??? ? ? ? ? ? production.log  
??? ? ? ? ? ? server.log  
??? ? ? ? ? ? test.log

(entries are in red and blinking)

BUT

$ sudo ls -la log/  
Password:  
total 4  
drw-rw-rw- 2 nobrow apache 168 Oct 24 20:12 .  
drwxr-xr-x 14 nobrow apache 392 Oct 24 20:12 …  
-rw-rw-rw- 1 nobrow apache 2479 Oct 24 20:12 development.log  
-rw-rw-rw- 1 nobrow apache 0 Oct 24 20:12 production.log  
-rw-rw-rw- 1 nobrow apache 0 Oct 24 20:12 server.log  
-rw-rw-rw- 1 nobrow apache 0 Oct 24 20:12 test.log

I am the owner of these files so why do they not show up properly  
unless I list them as root? Of course the log files cant be accessed  
by the scripts to log messages either.

This is really bizarre.

Bash on Gentoo.

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 24, 2007, 9:45pm UTC](https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216/2 "2007-10-24T21:45:08Z")

</div>

cd into the directory where the “log” directory lives.

chmod a+x log

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 24, 2007, 9:48pm UTC](https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216/3 "2007-10-24T21:48:39Z")

</div>

On Oct 24, 8:44 pm, “Michael G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > get whenever anything (like script/generate) tries to log a message.  
> > ls: cannot access log/production.log: Permission denied  
> > BUT
> 
> > I am the owner of these files so why do they not show up properly  
> > unless I list them as root? Of course the log files cant be accessed  
> > by the scripts to log messages either.
> 
> > This is really bizarre.
> 
> > Bash on Gentoo.

Worked, thanks. Why? Why does the dir have to be a+x to be able to  
list the files? Are they not “real” files?

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 24, 2007, 9:49pm UTC](https://www.ruby-forum.com/t/bizarre-log-file-permissions/118216/4 "2007-10-24T21:49:49Z")

</div>

On Oct 24, 8:44 pm, “Michael G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > get whenever anything (like script/generate) tries to log a message.  
> > ls: cannot access log/production.log: Permission denied  
> > BUT
> 
> > I am the owner of these files so why do they not show up properly  
> > unless I list them as root? Of course the log files cant be accessed  
> > by the scripts to log messages either.
> 
> > This is really bizarre.
> 
> > Bash on Gentoo.

Same is true for tmp?
