Re: file permissions

Mikko Työläjärvi <[email protected]>
Newsgroups gmane.network.mathopd
Message-ID <[email protected]>
On Thu, 28 Mar 2002, David Mentis wrote:

> Sorry for this really newbie question, but I'm having the darndest time
> getting the log/err/pid files where I want them. First off, I'm running
> FreeBSD 4.2.
>
> File permissions on mathopd are 555 root.wheel. But files
> created by mathopd are daemon.wheel. I think that's something to do with
> BSD's rc.d system.

Not the with standard mathopd startup file in ports.  More likely,
you have "daemon" in your mathopd configfile.  For example, I have:

  gw% egrep 'User|Root' mathopd.conf
  User mathopd
  StayRoot Off

> That aside, I'd like to put the pid file with other pids in /var/run which
> has permissions of 775 root.wheel. My question is, if I'm a member of
> wheel and have no problems creating files in /var/run, why does mathopd? I
> get the error on startup:
>
> /usr/local/sbin/mathopd: Cannot open PID file
> open: Permission denied

Well, it probably doesn't have permission...  Once you figure out who
mathopd is really running as, you should be able to figure this one
out too.  For example:

  gw% ps -axw -opid,uid,ruid,rgid,command | grep mathopd
  266  1000  1000  1000 /usr/local/sbin/mathopd

If all else fails, use "truss" or "ktrace".

> If I create a directory /var/run/mathopd and chown it daemon.wheel,
> placing the files in there works fine. I looked through the code, and
> I'm also a little iffy about DEFAULT_FILEMODE, which is set 0666. When
> the pid file get's created it's as 640.  What am I missing?

Umask 027?  (I think that is configurable in mathopd.conf as well.)

  $.02,
  /Mikko

 Mikko Työläjä[email protected]
 RSA Security
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.