Results 1 to 10 of 11
Hello,
My question is for send mail server 12.5
we enabled forwarding on all users now How can I remove the forwarding on 3000 users at once.
Below is the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-27-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 7
How can we remove Email Forwarding from 3000 users
Hello,
My question is for send mail server 12.5
we enabled forwarding on all users now How can I remove the forwarding on 3000 users at once.
Below is the method which I have adopted right now to remove the forwarding from all users…
sudo /bin/rm /home/username/.forward
this is very hectic for me to delete one by one. Is there any script which we have to use so that my activity become more easier..?
looking forward for your response and kind assistance
Asim Faraz
+92-333-3122419
- 08-27-2010 #2I would STRONGLY recommend to do a full backup before doing this.Code:
sudo /bin/rm /home/*/.forward
- 08-27-2010 #3
Hmm, he said 3000 users, not all users.
If there are more, then the backup is needed indeed :P
Is there a list of these 3000 users?You must always face the curtain with a bow.
- 08-27-2010 #4Just Joined!
- Join Date
- Aug 2010
- Posts
- 7
Email Forwarding removal
yes indeed!
you are right we do have more than 3000 users.
Look the scenerio is like we have a list of users in notepad or excel file now i have to delete these specific users which are only in that file...
rst of them should not be deleted in any case.
thanks
- 08-27-2010 #5
oki,
assuming
- you have a list of usernames
- the list is one name per line, ideally ending in unix linefeed convention. aka no windows style CR/LF
- the username are sane (no special chars, spaces, etc)
- the usernames are equal to the homedirectory names
- the homedirectories are under /home
- you are root
then something like this comes to mind:
Look for erros, look for consistency, look for correct number ( | wc -l).Code:for USERNAME in `cat userlist`; do ls -la /home/$USERNAME/.forward ; done
If you are happy with what you see, replace the ls -la with a rm -f.You must always face the curtain with a bow.
- 08-27-2010 #6Just Joined!
- Join Date
- Aug 2010
- Posts
- 18
You can simply use find command
to find
andCode:find /home/ -name '.forward' -print
to delete them.Code:find /home/ -name '.forward' -delete
And yes, it would be better to perform backup before doing this.
- 08-27-2010 #7
The find will delete all.
Jamikhan needs to delete only 3000You must always face the curtain with a bow.
- 08-27-2010 #8Just Joined!
- Join Date
- Aug 2010
- Posts
- 18
Ohh, yes, thank you.
I just missed that message.
- 08-27-2010 #9
As irithori said, this will NOT work with usernames like "John Smith" as that will try to remove a user "John" and a user "Smith". Just wanted to point that out.
You could do also the inverse:
Code:for user in /home/*; do # check if $user should be deleted in some or the other way if [ fgrep SOME_ARGS ]; then rm -rf $user; fi done
- 08-27-2010 #10Just Joined!
- Join Date
- Aug 2010
- Posts
- 7
i will check all these options
thanks in advance..
but i need to be sure that it will not harm my user IDs..it will just remove email forwarding from them....?
Jami


Reply With Quote

