🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #43119

Re: slrn FAQ

#43119
From: Sylvain Robitaille
Date: Tue, 08 Sep 1998 00:00
187 lines
8213 bytes
On 7 Sep 1998 11:05:11 GMT, I wrote:

>> Either adjust permissions accordingly, or run slrnpull with privileges.

On 7 Sep 1998 16:08:30 GMT, David L. Vondrasek
<davidNOSPAM@tabletop.stumbleinn.dyn.ml.org> wrote:

> That may be the problem. But I have tried running it as root also 
> and get the same errors. See below:

> root@tabletop:/var/spool/news/slrnpool : slrnpull -h news.airmail.net

Hrmmm... Check the compiled-in directory. I run slrnpull from a modified
copy of the slrnpull.sh script which comes with the slrn distribution.
In the script, I have specifically indicated which directory to use as
the slrnpull "root" directory:

    #!/bin/sh
    
    # This script is run from cron early every morning. It performs the
    # following:
    #
    #     1.  Runs slrnpull in expire mode to expire old articles
    #     2.  Runs slrnpull to grab articles from the server
    
    # Configuration variables.
    dir=/local/var/slrnpull
    server=newshost.isp.domain
    slrnpull=/local/bin/slrnpull
    
    #----------------------------------------------------------------
    umask 022
    
    # Before getting new articles, perform expiration.
    $slrnpull -d $dir --expire
    
    # ok, now let's get new articles.
    $slrnpull -d $dir -h $server

> 09/07/1998 11:05:22 ***Unable to open /var/spool/news/slrnpull/log for
>                     logging.
> 09/07/1998 11:05:22 slrnpull started.
> 09/07/1998 11:05:22 ***Unable to create directory
>                     /var/spool/news/slrnpull/news. (errno = 2)
> 09/07/1998 11:05:22 A total of 0 bytes received, 0 bytes sent in 0 seconds.

Ahhh... now wait a minute. "errno = 2" should help...

In "/usr/include/asm/errno.h", I see:

    #define ENOENT     2  /* No such file or directory */

Are you *sure* /var/spool/news/slrnpull exists and is a directory?
(Forgive me if you've checked this. It's just that the error message
*does* point to that.)

> Just for test I chmod'ed the directories to 777 and even ran as root
> as you can see.And all directories are there.

'ls -ld' of the directories in question might be useful here. (Though
running as root, I can't think of what the trouble might be. :-( )

>> With respect to the latter, I really recommend that you run slrnpull
>> with its own userid, (say 'news') with appropriate ownership and
>> permissions on the SLRNPULL_ROOT_DIR. You might want to have a look at
>> a patch I posted a while back (I'll repost if you like) which makes
>> that possible.
>
> I'd be more then willing to try the patch you have.

Well it won't help with the problem you're having, I'm afraid, but it
*does* permit you to run slrnpull with its own privileges, without
needing it to run as root.

I'm afraid I don't have a copy of the original post handy, but here's
the patch (Apply from the directory where the slrn source unpacks
into):

    *** src/slrnpull.c.original	Mon Apr 20 16:22:12 1998
    --- src/slrnpull.c	Tue Jul  7 22:30:28 1998
    ***************
    *** 1486,1493 ****
      	return -1;
           }
      	
    !    if (-1 == chmod (dir, 0777 | 01000))
    !      log_error ("chmod 01777 failed on %s.", dir);
         
         return 0;
      }
    --- 1486,1503 ----
      	return -1;
           }
      	
    !    /*
    !     * 1998/07/07 Sylvain Robitaille (syl@alcor.concordia.ca)
    !     *            Make this directory setgid so all files created in it
    !     *            will be owned by the group owner of the directory,
    !     *            (presumably group 'news'). This way, slrnpull can run
    !     *            as a regular user (news.news) and be given proper
    !     *            permissions to manipulate files in the out.going
    !     *            directory. (NOTE: This has only been tested on
    !     *            Linux-2.0.xx)
    !     */
    !    if (-1 == chmod (dir, 0777 | 03000))
    !      log_error ("chmod 03777 failed on %s.", dir);
         
         return 0;
      }

    *** src/server.c.original	Mon Apr 20 16:22:10 1998
    --- src/server.c	Tue Jul  7 22:55:02 1998
    ***************
    *** 532,537 ****
    --- 532,550 ----
         if (Pull_Fp == NULL)
           return ERR_FAULT;
         
    +    /*
    +     * 1998/07/07 Sylvain Robitaille (syl@alcor.concordia.ca)
    +     *            We have our out.going directory setgid to news, and we
    +     *            want to be sure the file is readable and writable to
    +     *            group news. This way, the news user will have
    +     *            appropriate permissions for manipulating this file.
    +     *            (NOTE: This has only been tested on Linux-2.0.xx)
    +     */
    +    if (-1 == chmod (Pull_Post_Filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP))
    +      {
    +        return ERR_FAULT;
    +      }
    + 
         if (-1 == slrn_fclose (Pull_Fp))
           {
      	Pull_Fp = NULL;

Now make sure that all the directories and log files slrnpull will need
to write to are writeable to user 'news', (or whatever user you choose
to run slrnpull as). Also make sure that any files already in the
'out.going' directory are writeable to group 'news' (or whatever group
your news user will belong to).

Last, make sure that the out.going directory is mode 1777, so anyone can
write to it, but they can only delete files they own.

I have the following setup on my system:

    : elvira[syl] ~; ls -ld /local/var/slrnpull
    drwxr-xr-x   6 news  news      1024 Sep  7 06:33 /local/var/slrnpull/
    : elvira[syl] ~; ls -l /local/var/slrnpull
    total 50
    drwxr-xr-x   2 news  news      1024 Sep  7 22:15 data/
    -rw-r--r--   1 news  news     18780 Sep  7 22:15 log
    drwxr-xr-x   6 news  news      1024 Jul  5 21:57 news/
    drwxr-xr-x   2 news  news      1024 Aug  7 20:29 old/
    drwxrwsrwt   3 news  news      1024 Sep  7 22:43 out.going/
    -rw-rw-r--   1 news  news     21560 Sep  6 12:25 score
    -rw-r--r--   1 root  system    2521 Aug  7 20:29 slrnpull.conf

(The 'old' directory is where I keep backup copies of the conf file
when editting -- the 'news' directory is the news spool, so I won't
bother giving you a listing of that.)

    : elvira[syl] ~; ls -l /local/var/slrnpull/out.going/
    total 5
    -rw-rw----   1 syl   news      3904 Sep  7 22:43 X905222621-3114-1.syl
    drwxr-xr-x   2 news  news      1024 Jul  7 22:08 rejects/

Here you see a post waiting to be sent. A user in group 'news' (such as
user 'news') will be able to delete the file because of the group
permission. Also the 'news' user needs to be able to read the file to
even be able to post it. Again the group permission takes care of that.

    : elvira[syl] ~; ls -l /local/var/slrnpull/data
    total 1
    -rw-r--r--   1 news  news       521 Sep  7 22:15 active

I hope that helps...

-- 
----------------------------------------------------------------------
Sylvain Robitaille                              syl@alcor.concordia.ca

Systems Manager                                   Concordia University
Instructional & Information Technology        Montreal, Quebec, Canada
----------------------------------------------------------------------

Technical Details
Message-ID: <slrn6v9aat.31a.syl@elvira.rodents.montreal.qc.ca>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <slrn6u4a5q.ff.davis@space.mit.edu> <6s66io$hc1$1@aurwww.aur.alcatel.com> <slrn6uobj5.91.davis@mygir.davis.net> <38739E79D43936AE.AEB34D87961BC690.9E8BE0152D9F0ECF@library-proxy.airnews.net> <slrn6v5fg6.ull.syl@elvira.rodents.montreal.qc.ca> <529FBA9D40C7536F.C9CBB45E7283CDA5.3B28530692C5E43B@library-proxy.airnews.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6v9aat.31a.syl@elvira.rodents.montreal.qc.ca>
Subject: Re: slrn FAQ
Date: Tue, 08 Sep 1998 00:00:00 +0000
From: syl@alcor.concordia.ca (Sylvain Robitaille)
References: <slrn6u4a5q.ff.davis@space.mit.edu> <6s66io$hc1$1@aurwww.aur.alcatel.com> <slrn6uobj5.91.davis@mygir.davis.net> <38739E79D43936AE.AEB34D87961BC690.9E8BE0152D9F0ECF@library-proxy.airnews.net> <slrn6v5fg6.ull.syl@elvira.rodents.montreal.qc.ca> <529FBA9D40C7536F.C9CBB45E7283CDA5.3B28530692C5E43B@library-proxy.airnews.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 388993089
Organization: Concordia University -- Montreal, Quebec, Canada
Newsgroups: news.software.readers
NNTP-Posting-User: news