How use API to --disable-email

5 posts / 0 new
Last post
#1 Tue, 06/25/2013 - 20:06
jimdunn

How use API to --disable-email

Hey All,

I'd really like some help on this, thought it would be a no-brainer, but my brain must be getting in the way...

- I created a bunch of domains (90 virtual servers)
- all the "Administration users" had email boxes created for them
- I need to "disable the Primary email"
- wrote this cool script in debian shell script:

# virtualmin modify-user --domain foo01.com --user foo01 --disable-email
# virtualmin modify-user --domain foo02.com --user foo02 --disable-email
...
# virtualmin modify-user --domain foo89.com --user foo89 --disable-email
# virtualmin modify-user --domain foo90.com --user foo90 --disable-email

- I logged into virtualmin as root
- but I get the following error:

ERROR: The user foo01 is the owner of server foo01.com, and so cannot be modified.

- I know I can disable it from EDIT USER screen in the control panel
- but I sure hoped I could just do it quickly using a shell script

Can anyone help me? Thx!

Tue, 06/25/2013 - 20:14
jimdunn

Or, if that's not possible, can I change the Server Template Apache Website section, then run the "Regenerate Apache VirtualHost Information" script over in the examples???

#!/bin/sh
doms=`virtualmin list-domains --with-feature web --name-only`
for dom in $doms; do
virtualmin disable-feature --domain $dom --web --webalizer --logrotate
virtualmin enable-feature --domain $dom --web --webalizer --logrotate
done

Wed, 06/26/2013 - 08:07
andreychek

I've been talking to Jamie about how to do that... I'll let you know once I determine a way to make that work :-)

-Eric

Wed, 06/26/2013 - 18:05
andreychek

Okay, so I have good news, and bad news.

The good news is that it shouldn't work that way, and it sounds like you found a bug! We're thankful for that, and it'll be fixed soon.

The bad news though is that it won't be fixed until the next Virtualmin version is released, which is probably a few weeks away.

If you're in a bind, and hoping to make those changes sooner -- you could always edit /usr/{libexec|share}/webmin/virtual-server/modify-user, jump to line 247, and comment out this line:

$user->{'domainowner'} && &usage("The user $username is the owner of server $domain, and so cannot be modified");

That'll remove the check that's preventing you from running that command.

-Eric

Wed, 06/26/2013 - 18:31
jimdunn

Wow, impressive reply, thx so much! : )

Topic locked