-#!/usr/bin/perl -w
+#!/usr/bin/perl
use strict;
+use warnings;
use Getopt::Long;
use PVE::Tools qw(run_command);
use PVE::Cluster;
#fixme: logging?
-die "please run as root\n" if $> != 0;
-
-PVE::INotify::inotify_init();
-
-my $rpcenv = PVE::RPCEnvironment->init('cli');
-
-$rpcenv->init_request();
-$rpcenv->set_language($ENV{LANG});
-$rpcenv->set_user('root@pam');
-
-# autmatically generate the private key if it does not already exists
-PVE::Cluster::gen_auth_key();
-
my $read_password = sub {
# return $ENV{PVE_PW_TICKET} if defined($ENV{PVE_PW_TICKET});
my ($res) = @_;
print "$res->{ticket}\n";
}],
+
+ passwd => [ 'PVE::API2::AccessControl', 'change_passsword', ['userid'] ],
+
useradd => [ 'PVE::API2::User', 'create_user', ['userid'] ],
usermod => [ 'PVE::API2::User', 'update_user', ['userid'] ],
userdel => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
my $cmd = shift;
+if (defined($cmd) && $cmd ne 'verifyapi' && $cmd ne 'printmanpod') {
+ die "please run as root\n" if $> != 0;
+
+ PVE::INotify::inotify_init();
+
+ my $rpcenv = PVE::RPCEnvironment->init('cli');
+
+ $rpcenv->init_request();
+ $rpcenv->set_language($ENV{LANG});
+ $rpcenv->set_user('root@pam');
+
+# autmatically generate the private key if it does not already exists
+ PVE::Cluster::gen_auth_key();
+}
+
PVE::CLIHandler::handle_cmd($cmddef, "pveum", $cmd, \@ARGV, $read_password, $0);
exit 0;