Koozali.org: home of the SME Server

user-modify

Offline Catton

  • *
  • 36
  • +0/-0
user-modify
« on: October 18, 2011, 12:07:31 AM »
I would like modify an existing user via a script. Ie . add a user to a group and remove a user from a group.
I believe the proper way would be signal-event user-modify ‘username’ …. but I am not sure the proper syntax and could not find an example of such.
I would run this in a cron job.
Any help would be greatly appreciated


Offline janet

  • *****
  • 4,812
  • +0/-0
Re: user-modify
« Reply #1 on: October 18, 2011, 02:08:57 AM »
Catton

I'm sure if you search these forums you would find numerous examples.

Here is a sure fire way to find out any command that sme server uses.
Make whatever change in server manager eg change/modify/add a user.
Then review the messages log file most recent entries and you will see all the commands & syntax that were issued to enact that change.

Copy the command and syntax and signal event to suit your specific requirement.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Catton

  • *
  • 36
  • +0/-0
Re: user-modify
« Reply #2 on: October 21, 2011, 02:56:12 AM »
Thanks Mary

I handnt thought of using messages that way. I also tried it with lazy admin tools 'lat-groups'. In both cases it the log showed the db OLD NEW followed by event: group-modify. My Lazy-Admin solution was

lat-groups -r -f -c " zgroup | zztest "
lat-groups -a -c "zgroup | testgrp | | zztest"

lat worked easy to remove
lat-groups -r -f -c " group | user "
But to add the user back to the group lat required the | Description |
lat-groups -a -c "group | description | | user"



Oct 20 17:33:41 smfserver02 /usr/sbin/lat-groups[17688]: /home/e-smith/db/accounts: OLD zgroup=group|Description|testgrp|Gid|5469|Members|zztest|Uid|5469
Oct 20 17:33:41 smfserver02 /usr/sbin/lat-groups[17688]: /home/e-smith/db/accounts: NEW zgroup=group|Description|testgrp|Gid|5469|Members||Uid|5469
Oct 20 17:33:41 smfserver02 esmith::event[17689]: Processing event: group-modify zgroup