[BlueOnyx:14472] Re: BlueOnyx YUM updates: 5106R/5107R/5108R

Michael Stauber mstauber at blueonyx.it
Fri Feb 7 09:35:43 -05 2014


Hi Stefano,

> It varies from server to server, someone has 90+ others 10+ virtual sites .
> I've checked on the cmodvsite \ vmoduser, but i didnt find any info about 
> changing the site owner .

Here is a quick and dirty how-to for the command line CCE client:

Run /usr/sausalito/bin/cceclient

Find out which database object ID the Vsite with the name in question has:

find Vsite fqdn = "www.smd.net"
104 OBJECT 31
201 OK

It's OID 31. So then we just run this command to set user "johndoe" as
owner of it:

SET  31 createdUser = "johndoe"

That's basically it. You'll have to repeat it for all the Vsites that
you want to give him ownership.

And here is a script for that:

----------------------------------------------
#!/usr/bin/perl -I/usr/sausalito/perl
# $Id: fastadmin.pl, v 1.0.0-1
# Copyright 2014 Michael Stauber

use CCE;
my $cce = new CCE;
$cce->connectuds();

# Root check:
my $id = `id -u`;
chomp($id);
if ($id ne "0") {
    print "$0 must be run by user 'root'!\n";
    $cce->bye('FAIL');
    exit(1);
}

# Edit these two lines:
$new_admin = "johndoe";
@sites_he_owns = ("www.smd.net", "test.smd.net");

# Walk through all Vsites:
for my $fqdn (@sites_he_owns) {
    (@OIDs) = $cce->findx('Vsite', '', {'fqdn' => $fqdn});

    print "Setting $new_admin as owner for: $fqdn \n";

    for my $fqdn_oid (@OIDs) {
       ($ok) = $cce->set($fqdn_oid, '',{
        'createdUser' => $new_admin
       });
    }
}

# Tell CCE we're done:
$cce->bye('SUCCESS');
exit(0);
----------------------------------------------

It's a quick and dirty script without any bells and whistles. Change
"johndoe" to the username of the admin. And change the line ...

@sites_he_owns = ("www.smd.net", "test.smd.net");

... so that this array contains all the sites that he's supposed to own.

Then chmod 755 this script and run it as "root".

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list