Koozali.org: home of the SME Server

Edit another user's mailsorting rules from command line

Offline CmdLn

  • **
  • 57
  • +0/-0
Edit another user's mailsorting rules from command line
« on: October 01, 2015, 01:35:07 PM »
Is it possible to modify mailsorting from the command line on a per user basis?

Offline Stefano

  • *
  • 10,836
  • +2/-0
Re: Edit another user's mailsorting rules from command line
« Reply #1 on: October 01, 2015, 04:43:03 PM »
can you give us some details on what are you trying to achieve?

Offline CmdLn

  • **
  • 57
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #2 on: October 02, 2015, 07:15:05 AM »
I want to setup a mail forward for a user without knowing the user's password. Currently I log in to usermanager as that user and setup a mailsorting to do this.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #3 on: October 02, 2015, 08:57:14 AM »
CmdLn

Quote
I want to setup a mail forward for a user without knowing the user's password. Currently I log in to usermanager as that user and setup a mailsorting to do this.

The GUI interfaces are just editing/creating db entries & issuing various commands.
You can typically look to see what commands are issued etc in the messages log file, then replicate that at the command prompt as the root or equivalent user.
If dealing with user text type entries, then remember, where necessary, to correct permissions on files to be that of the user rather than root, when finished.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline CmdLn

  • **
  • 57
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #4 on: October 02, 2015, 09:10:42 AM »
Thanks, that what I was thinking, but where do I find the commands related to the GUI for mailsorting?

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #5 on: October 02, 2015, 10:14:47 AM »
Thanks, that what I was thinking, but where do I find the commands related to the GUI for mailsorting?
You say mailsorting, not sure what you are specifically referring to.

If you want to set up a forward for a user, open server manager, open the User panel & edit the user, & add the forward address.
Then review the log file named messages
ie /var/log/messages, you can do this is server manager View log files

Then look at the time & find the command that was issued when you did this in the server manager GUI
then type in a similar command at the command prompt as root user, followed by the appropriate signal event commands as seen in the messages log file

If you want to edit or create a particular users mail filtering files then you can do that easily also.
cd /home/e-smith/files/users/username/
edit as required eg .procmailrc .mailfilter .qmail & so on but be aware that changes you make there may be lost
where username = actual users name in SME server

Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline CmdLn

  • **
  • 57
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #6 on: October 02, 2015, 10:37:52 AM »
Seems to be executing /home/e-smith/db/processmail, but it looks like its run for every line in the .procmail so its way too complicated to do manually.

Thanks for the help but it seems like there is not way for the administrator to do this without having the users password unless as you say, do manual edits to .procmail which I have found dont work.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #7 on: October 02, 2015, 03:34:02 PM »
Seems to be executing /home/e-smith/db/processmail, but it looks like its run for every line in the .procmail so its way too complicated to do manually.

Thanks for the help but it seems like there is not way for the administrator to do this without having the users password unless as you say, do manual edits to .procmail which I have found dont work.

Did you read
http://wiki.contribs.org/Mailsorting

where it says:

individual setting
if you want to avoid manual editing of an individual .procmailrc to be deleted by templates
db accounts setprop USERNAME geekmode enabled

AFAIK if you can do it using the GUI, then you can do it using the command line, so maybe you need to search & read more.

It might also help if you post exactly what you want to do here, what command line changes you have tried, & what is or is not happening for you, rather than saying "it does not work".
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: Edit another user's mailsorting rules from command line
« Reply #8 on: October 02, 2015, 05:06:07 PM »
I want to setup a mail forward for a user without knowing the user's password.
Perhaps I'm missing something here.  Am I understanding correctly that you want to send all mail for user@yourdomain to someoneelse@someotherdomain?  If so, that's trivially accomplished through the server-manager.  Go to Users, find the account, click Modify, select "Forward" under "Email Delivery", and enter the forwarding address in the field below.

If you want to do that from the CLI instead, do

Code: [Select]
# db accounts setprop <user> EmailForward forward ForwardAddress <forwarding address>
# signal-event email-update

If you're the admin, nothing here needs the user's password.
......

Offline CmdLn

  • **
  • 57
  • +0/-0
Re: Edit another user's mailsorting rules from command line
« Reply #9 on: October 05, 2015, 09:17:49 AM »
Thanks DanB35 thats exactly what I was looking for.