# Logger and file permissions

**URL:** <https://www.ruby-forum.com/t/logger-and-file-permissions/63218>\
**Category:** Ruby\
**Created:** [June 13, 2006, 9:38am UTC](https://www.ruby-forum.com/t/logger-and-file-permissions/63218 "2006-06-13T09:38:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 13, 2006, 9:38am UTC](https://www.ruby-forum.com/t/logger-and-file-permissions/63218/1 "2006-06-13T09:38:44Z")

</div>

Ruby and linux Nuby question about getting Logger library to work.

I’ve got a simple ruby script that is set up as the receptor of mail to  
a particular address on my server (via postfix). This script is trying  
to use Logger to write a log file. I’m trying to put the log file in a  
subdirectory of the html directory (in other words, far removed from  
where the ruby script lives). I have tried to set up a group that  
includes ruby, the script, and the logger library as users and have set  
the group of the destination directory to that group, and set up  
permissions on that dir to 775. I continue to get the following error  
in the mail admin bounce message

Command died with status 1:  
“/usr/local/bin/rantilizer.rb”. Command output:  
/usr/local/lib/ruby/1.8/logger.rb:541:in `initialize': Permission denied - /home/[my domain directory here]/www/html/rants/myLog.log (Errno::EACCES) from /usr/local/lib/ruby/1.8/logger.rb:541:in`open’ from  
/usr/local/lib/ruby/1.8/logger.rb:541:in `create_logfile' from /usr/local/lib/ruby/1.8/logger.rb:536:in`open\_logfile’ from  
/usr/local/lib/ruby/1.8/logger.rb:497:in `initialize' from /usr/local/lib/ruby/1.8/logger.rb:256:in`new’ from  
/usr/local/lib/ruby/1.8/logger.rb:256:in `initialize' from /usr/local/bin/rantilizer.rb:5:in`new’ from  
/usr/local/bin/rantilizer.rb:5

This is on a REHL4 linux box. When I temporarily set the permissions of  
the destination directory to 777, it all works just fine, but obviously  
I don’t want to leave the permissions that way.

What is the right way to allow focused write permission to a ruby script  
and its libraries? Am I on the right track but need to add some more  
things to the group?

thanks,  
jp

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 14, 2006, 12:25am UTC](https://www.ruby-forum.com/t/logger-and-file-permissions/63218/2 "2006-06-14T00:25:04Z")

</div>

On Jun 13, 2006, at 3:39 AM, Jeff P. wrote:

> I have tried to set up a group that  
> includes ruby, the script, and the logger library as users

Um, groups include users (logins). A group or user is not per-file/  
executable (unless you have setuid or setgid set). Are we maybe  
confused about the Unix security model? You need to run ruby as a  
user with access to that directory.

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 14, 2006, 7:28am UTC](https://www.ruby-forum.com/t/logger-and-file-permissions/63218/3 "2006-06-14T07:28:01Z")

</div>

Thanks Logan,  
Yes “we” were confused (or rather poorly self educated) on the unix  
security model. I found this to be a good explanation for a newbie such  
as myself:  
[http://www.dsm.fordham.edu/~moniot/Classes/InternetWebF00/unix-security/unix-security.html](http://www.dsm.fordham.edu/~moniot/Classes/InternetWebF00/unix-security/unix-security.html)

jp

Logan C. wrote:

> On Jun 13, 2006, at 3:39 AM, Jeff P. wrote:
> 
> > I have tried to set up a group that  
> > includes ruby, the script, and the logger library as users
> 
> Um, groups include users (logins). A group or user is not per-file/  
> executable (unless you have setuid or setgid set). Are we maybe  
> confused about the Unix security model? You need to run ruby as a  
> user with access to that directory.
