How to create users using CLI?

Hi,

How do I create new users using command line interface (CLI)?

The book says that the command is

rt create -t user …

and then I should type options. What exactly is the syntax? Can anyone
post an example?

I need to create a user and specify (at minumum):
userid
password
email
Name

a new user should be given right to read all tickets, create tickets.

Tomasz Wlodek | tel 631-344-7448
Brookhaven Laboratory, Building 510M | fax 631-344-7616
Upton NY 11973-5000 |

Hi,

I am trying to create users using command line interface. I do:

./rt create -t user set username=test1 emailaddress=a@b.com password=testpwd

But then rt asks me for password:

Password:

Question 1: Which password does it want? the root pwd for RT mysql
database? or the superuser password?

Question 2: Can I get rid of the password question? My users will be
created automatically in a script which calls “rt create …”.

I see in the rt code subroutine

read_passwd sub read_passwd {
eval ‘require Term::ReadKey’;
if ($@) {
die “No password specified (and Term::ReadKey not installed).\n”;
}

print "Password: ";
Term::ReadKey::ReadMode('noecho');
chomp(my $passwd = Term::ReadKey::ReadLine(0));
Term::ReadKey::ReadMode('restore');
print "\n";

return $passwd;

}

What will happen if I throw away content of this routine and make it
return the mysql root password?

Is there a simpler way to bypass the password question?

Tomasz Wlodek | tel 631-344-7448
Brookhaven Laboratory, Building 510M | fax 631-344-7616
Upton NY 11973-5000 |

I think the rt command looks for the environment variables
RTUSER and RTPASSWD for authentication to the RT server.

Yes:

Environment variables:

    The following environment variables override any corresponding
    values defined in configuration files:

    - RTUSER
    - RTPASSWD
    - RTSERVER
    - RTDEBUG       Numeric debug level. (Set to 3 for full logs.)
    - RTCONFIG      Specifies a name other than ".rtrc" for the
                    configuration file. 
    - RTQUERY       Default RT Query for rt list 
    - RTORDERBY     Default order for rt list

-ToddOn Wed, May 10, 2006 at 04:22:44PM -0400, Tomasz Wlodek wrote:

Hi,

I am trying to create users using command line interface. I do:

./rt create -t user set username=test1 emailaddress=a@b.com password=testpwd

But then rt asks me for password:

Password:

Question 1: Which password does it want? the root pwd for RT mysql
database? or the superuser password?

Question 2: Can I get rid of the password question? My users will be
created automatically in a script which calls “rt create …”.

I see in the rt code subroutine

read_passwd sub read_passwd {
eval ‘require Term::ReadKey’;
if ($@) {
die “No password specified (and Term::ReadKey not installed).\n”;
}

print "Password: ";
Term::ReadKey::ReadMode('noecho');
chomp(my $passwd = Term::ReadKey::ReadLine(0));
Term::ReadKey::ReadMode('restore');
print "\n";

return $passwd;

}

What will happen if I throw away content of this routine and make it
return the mysql root password?

Is there a simpler way to bypass the password question?

Tomasz Wlodek | tel 631-344-7448
Brookhaven Laboratory, Building 510M | fax 631-344-7616
Upton NY 11973-5000 |


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical: Careers — Best Practical Solutions