Koozali.org: home of the SME Server

LearnAsNoSpam fpr Sonora Bayesian filtering ?

Offline kevinb

  • *
  • 237
  • +0/-0
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #15 on: October 01, 2008, 07:54:28 PM »
So ...  a chmod, chown and/or chgroup is in order.

Have you tried this or implemented something similar?

Offline Amir Inbar

  • *
  • 113
  • +0/-0
    • http://www.sheroot.net
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #16 on: October 01, 2008, 08:50:32 PM »
tnx Kevinb for fast answer.

I don't know how to include it at the script since i run it as root.
how do you use it to change the ownership of each user to the user's ownership and group ?
......

Offline kevinb

  • *
  • 237
  • +0/-0
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #17 on: October 01, 2008, 11:58:36 PM »
I am not a scripting guru but I am sure you can do everything through the command line.

You would have to parse the user's names and their groups and them apply the new ownership and permissions accordingly.

Another option would be to give everyone all rights to all the folders and contents ... chmod 777 etc. I can't think of any security issue with this but then again I am also not a security guru.

Sorry I couldn't be more help.

Offline Amir Inbar

  • *
  • 113
  • +0/-0
    • http://www.sheroot.net
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #18 on: October 02, 2008, 07:47:51 AM »
Tnx for trying anyway.

I'll try to study it and i'll publish my findings later ...


......

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #19 on: October 02, 2008, 06:48:24 PM »
There is one problem with :since it is ran as root, the owner is root and the group is root thus users can't copy mail to folders created.
This should do the trick I guess setting the proper ownership as well as excluding the admin folder as this does not hold a Maildir.:
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
mkdir -p $u/Maildir/.LearnAsHam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsHam/; \
mkdir -p $u/Maildir/.LearnAsSpam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsSpam/; \
done; \
popd

Edit: exluded admin user as it does not have a Maildir
« Last Edit: October 02, 2008, 06:53:10 PM by cactus »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Amir Inbar

  • *
  • 113
  • +0/-0
    • http://www.sheroot.net
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #20 on: October 02, 2008, 11:00:37 PM »
Cactus,
Thank you for helping but this script gets the username as "./user" instead of "user"

here is an explanation :
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `find  -maxdepth 1 -type d`; \
do \
echo $u
done; \
popd
that gives :
Quote
/home/e-smith/files/users /home/e-smith/files/users
.
./rutish
./anatiz
./home
./hadas
/home/e-smith/files/users


So when i try
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `find -maxdepth 1 -type d`; \
do \
mkdir -p $u/Maildir/.LearnAsHam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsHam/; \
mkdir -p $u/Maildir/.LearnAsSpam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsSpam/; \
mkdir -p $u/Maildir/.LearnInWL/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnInWL/; \
done; \
popd

I get

Quote
/home/e-smith/files/users /home/e-smith/files/users
chown: `.:.': invalid user
chown: `.:.': invalid user
chown: `.:.': invalid user
chown: `./rutish:./rutish': invalid user
chown: `./rutish:./rutish': invalid user
chown: `./rutish:./rutish': invalid user
chown: `./anatiz:./anatiz': invalid user
chown: `./anatiz:./anatiz': invalid user
chown: `./anatiz:./anatiz': invalid user
chown: `./home:./home': invalid user
chown: `./home:./home': invalid user
chown: `./home:./home': invalid user
chown: `./hadas:./hadas': invalid user
chown: `./hadas:./hadas': invalid user
chown: `./hadas:./hadas': invalid user
/home/e-smith/files/users
......

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #21 on: October 03, 2008, 09:16:33 AM »
Cactus,
Thank you for helping but this script gets the username as "./user" instead of "user"

here is an explanation :
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `find  -maxdepth 1 -type d`; \
do \
echo $u
done; \
popd
that gives :
So when i try
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `find -maxdepth 1 -type d`; \
do \
mkdir -p $u/Maildir/.LearnAsHam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsHam/; \
mkdir -p $u/Maildir/.LearnAsSpam/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnAsSpam/; \
mkdir -p $u/Maildir/.LearnInWL/{cur,new,tmp}; \
chown -R $u:$u $u/Maildir/.LearnInWL/; \
done; \
popd

I get

Have a look at my post again, I almost immediately modified it as I noticed this problem as well. The current version above should not have this issue, furthermore the others should have the proper ownership now, the difference is that the new version does only lists real directories where the find command would also insert the '.' and the './' before, the version with ls should work properly.
« Last Edit: October 03, 2008, 09:20:08 AM by cactus »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Amir Inbar

  • *
  • 113
  • +0/-0
    • http://www.sheroot.net
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #22 on: October 03, 2008, 06:04:48 PM »
Thank you Cactus - that did the Trick.
I will try to aknowledge the builders of Learn contrib and Sme-unjunkmgr contrib to include the script with the Howto.

Amir
......

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: LearnAsNoSpam fpr Sonora Bayesian filtering ?
« Reply #23 on: October 04, 2008, 08:47:19 AM »
Thank you Cactus - that did the Trick.
I will try to aknowledge the builders of Learn contrib and Sme-unjunkmgr contrib to include the script with the Howto.

Amir
AFAIK they do not need to, they just need to add those directories to the cd /etc/e-smith/skel/user/Maildir/ folder so all new users automatically have these folders created, for existing users something like the script might be necessary but it should be tight into the event system.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)