Robert Schelander wrote:

> Do you know where is the right place to insert additional code when
> axipd does automatic user creation?
> What is the right c-syntax to execute a script? I know C, but I've never
> used it on a Linux machine. (up to now only on Windows based systems)
>
> The main reason I want to do this, is to give each user a www directory
> in his homedirectory and add it to the apache configuration.
> Maybe you know a more comfortable way without adding new code
> and recompile.

You're looking for axspawn.  Axspawn gets called from ax25d when a user
connects to the callsign you setup for the shell account.  The howto docs will
explain how to set that up.  It creates a user account and puts the
ax25.profile in the users directory as .profile.  I use this .profile to write
over itself creating a new .profile and some other files and directories.  I'll
include my ax25.profile, but it may be a bit more than you want... It sets up
htaccess and add a couple of simple cgi scripts.  You need to have suexe setup
for those to work.

Axspawn creates a xxx... subdirectory.  It's a pain.  You end up with a bunch
of directories with one user directory in it and that user only dropped by once
to look around. ;-(
I changed line 394 in axspawn. from this....
        sprintf(homedir, "%s/%s.../%s", start_home, subdir, newuser);

to this...
        sprintf(homedir, "%s/%s", start_home,  newuser);


Here's the ax25.profile

#! /bin/bash
#
if [ -f /etc/ax25env ]; then
        . /etc/ax25env
fi
PATH=.:$HOME/bin:$PATH
ENV=$HOME/.bashrc
USERNAME=$LOGNAME
export USERNAME ENV PATH
#
#
echo "default
   login anonymous
   password $LOGNAME@$HOSTNAME
   macdef init
   binary

" >.netrc
#
#
chmod 755 .
echo "/char ibmpc ibmpc" >.conversrc
echo  $LOGNAME: >.users
mkdir bin
mkdir -p pbbs.ctl
chmod 777 pbbs.ctl
touch pbbs.ctl/lastread
chmod 666 pbbs.ctl/lastread
#
mkdir public_html
mkdir public_html/private
#
echo "AuthName restricted $LOGNAME
AuthType Basic
AuthUserFile $HOME/.users
require user $LOGNAME
" > public_html/private/.htaccess

#
echo "<HTML><HEAD><TITLE>Test page for new accounts</TITLE></HEAD>
 <BODY
  BGCOLOR="#FFFFFF"
  TEXT="#000000"
  LINK="#0000FF"
  VLINK="#000080"
  ALINK="#FF0000"
 >
  <H1 ALIGN="CENTER">
   It Worked! <BR>
</CENTER></BODY></HTML>
" > public_html/index.html
#
echo '#!/usr/bin/perl
require "/etc/ribbs/readconf";
$hostname = substr(qx(/bin/hostname),0,-1);
print "Content-type: text/html\n\n";
print "<HTML><BODY BGCOLOR=#afcfef>";
print "<center>$haddress</center><pre>";
print "msg#     From                    Subject<br>";
(@line)=split(/\n/, qx(/usr/bin/frm -n));
foreach $line (@line){
$n=substr($line,0,3) if (substr($line,0,3) =~/^\d\d\d/);
$n=substr($line,1,2) if (substr($line,0,3) =~/^\D\d\d/);
$n=substr($line,2,1) if (substr($line,0,3) =~/^\D\D\d/);
print "<A HREF=readmail.cgi?$n>$line</a><br>";
}
print "</pre><hr></B></BODY></HTML>";
'> public_html/private/lp.cgi
chmod 700 public_html/private/lp.cgi
#
echo '#!/bin/bash  -f
haddress=`/etc/ribbs/readconf haddress`
echo Content-type: text/html
echo
echo  "<html><head><title>"$haddress"</title></head><BODY BGCOLOR=#afcfef>"
echo  "<center>"$haddress"</center>"
echo Message number $*
echo "<br><pre>"
/usr/bin/readmsg  -f  /var/spool/mail/$LOGNAME $*
echo "</pre> </html>"
echo
'> public_html/private/readmail.cgi
chmod 700 public_html/private/readmail.cgi
echo '
# This example if for using procmail.
#"|IFS=' ' && p=/usr/bin/procmail && test -f $p && exec $p -Yf- || exit 75' $LO

# This example is to just forward the mail to a new address.
#[EMAIL PROTECTED]
' >.forward
#
#
echo "#! /bin/bash
# User specific aliases and functions
if [ -f /etc/ax25env ]; then
        . /etc/ax25env
fi
# User specific environment and startup programs
PATH=.:\$HOME/bin:\$PATH
USERNAME=$LOGNAME
export USERNAME PATH
" > .profile
chmod 700 .profile



Bob

Reply via email to