LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-26-2005, 10:55 AM   #1
cyberjames
LQ Newbie
 
Registered: Dec 2004
Location: Singapore
Distribution: redhat, fedora, centos, debian, ubuntu
Posts: 20

Rep: Reputation: 0
Perl Script Program (need) : SpamAssassin-ClamAV-Procmail-Howto


Try to look out the "SpamAssassin-ClamAV-Procmail-Howto" from http://www.falkotimme.com/howtos/spa...ail/index.php. I did try to copy all ".antivirus.rc .html-trap.rc .spamassassin.rc .forward .procmailrc and .user_prefs" to "/etc/skel" so that when I use "useradd" with "-m and -k" option, that 6 *.filenames will be make a copy on user home directory.

When you look out inside the content of ".procmailrc and .spamassassin.rc", there was a specific user home directory path way (/home/www/web1/user/testuser/) that will need to change during when adding a new user email account and it needs to change also for the specific user home directory path way.

What I want to become is, if I add a user "james" with "-m and -k" option, all 6 *.filenames will be copied on my /home/james and besides that, the content inside of ".procmailrc and .spamassassin.rc" (from /home/www/web1/user/testuser/) will be change to /home/james. Yet, /home/james/.forward should be chown by the owner "james" and change mode (chmod) to 600 privilage.


Someone says that I need to make a perl script. I had no knowledge on perl Programming, I am hoping anyone could make me.


I hope you had a brilliant idea that you'll share to me for accomplishing this scenario. By the way, sorry for my horrendous english .

best regards
james
 
Old 01-26-2005, 12:13 PM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,436

Rep: Reputation: 93
Why not just change .procmailrc and .spamassassin.rc that are in /etc/skel dir so they reflect
the user path just by replacing /home/www/web1/user/testuser with the env variable $HOME ?
 
Old 01-27-2005, 09:53 AM   #3
cyberjames
LQ Newbie
 
Registered: Dec 2004
Location: Singapore
Distribution: redhat, fedora, centos, debian, ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Hi keefaz.

I try this on .procmail and .spamassassin.rc:

## .procmail ##
INCLUDERC=$ENV{HOME}/.antivirus.rc
INCLUDERC=$ENV{HOME}/.html-trap.rc
INCLUDERC=$ENV{HOME}/.spamassassin.rc

## .spamassassin.rc ##
* < 256000
| /usr/bin/spamassassin --prefs-file=$ENV{HOME}/.user_prefs


When I try to email, I can able to get email message. But, when I try of having
sample-spam.txt (w/c contains spam codes) and send it to the user, the user can
will recieved email but the message was not able to detect the spam attached file to notify the user.
Why? Maybe $ENV{HOME} was wrong?


james
 
Old 01-27-2005, 10:05 AM   #4
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,436

Rep: Reputation: 93
Try replace $ENV{HOME} with $HOME or make the path begin with ~/

and for spamassassin.rc :
* < 256000
| /usr/bin/spamassassin --prefs-file=~/.user_prefs

(It is just a suggestion though, I have not idea if it will work or not)
 
Old 01-27-2005, 10:46 AM   #5
cyberjames
LQ Newbie
 
Registered: Dec 2004
Location: Singapore
Distribution: redhat, fedora, centos, debian, ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Hi keefaz.


Its work. But When I send email with spam attached to the user, and
login to user email account, I noticed that the email message takes extra
time (at least 1 mins or 50 Seconds) before its arrived to the home user.


Now my problem is when I add a user account, I'll be going to use -m -k
/etc/skel on useradd command (useradd -m -l /etc/skel user). What I wanted
is when I issue "useradd user", the files will automatically generate and
copy to the home directory of user or if it possible to modify/add
codes from built-in "adduser" script in Slackware, will its better.


james
 
Old 01-27-2005, 10:56 AM   #6
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,436

Rep: Reputation: 93
Just do an alias in your ~/.bashrc like

alias newuser="useradd -m -l /etc/skel user"
 
Old 01-27-2005, 11:08 AM   #7
cyberjames
LQ Newbie
 
Registered: Dec 2004
Location: Singapore
Distribution: redhat, fedora, centos, debian, ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
If i will do alias newuser="useradd -m -l /etc/skel user" from ~/.bashrc , then when I issue useradd james , that will make /home/james homedir too? I'm curious why you put on ~/.bashrc since that is for invidual .bashrc for home user.

Im curious also in alias newuser="useradd -m -l /etc/skel user" , when that happen, that will create "user" account that will supposedly /home/user homedir?


james
 
Old 01-27-2005, 11:31 AM   #8
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,436

Rep: Reputation: 93
eh alias is a bash function, try it, open a terminal and type :
alias ll="ls -al"

now each time you type "ll" ls -al is executed
if you want bash aliases for root you put them in /root/.bashrc and even login as root or
su -
 
Old 01-27-2005, 11:53 AM   #9
cyberjames
LQ Newbie
 
Registered: Dec 2004
Location: Singapore
Distribution: redhat, fedora, centos, debian, ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
There is a problem. I did try your alias newuser="useradd -m -l /etc/skel user" and when i type newuser at prompt, I got

useradd: invalid option -- l
usage: useradd [-u uid [-o]] [-g group] [-G group,...]
[-d home] [-s shell] [-c comment] [-m [-k template]]
[-f inactive] [-e expire ] [-p passwd] name
useradd -D [-g group] [-b base] [-s shell]
[-f inactive] [-e expire ]

Well you have got wrong arguments, which is -l so i did change it to -k and i remove user. So now it becomes alias newuser="useradd -m -k /etc/skel" ... Now its work fine.


Thanks for the help keefaz!


james
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
howto start a perl script only from tuesday to friday at 8.00 am ? cccc Linux - Newbie 4 03-19-2005 04:23 AM
howto control a perl script by a hardware switch jujo Linux - Software 0 08-17-2004 03:24 PM
Procmail and ClamAV henno Linux - Security 2 08-13-2004 02:45 AM
spamassassin w/ procmail vs. spamassassin w/sendmail bleunuit Linux - Networking 1 08-01-2004 07:12 AM
howto send a mail with attachment via perl script ? cccc Programming 24 03-05-2004 07:49 PM


All times are GMT -5. The time now is 01:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration