Adding new users in command line

Hello,
I’ve written a small script that adds new users in command line to RT3,
which run by my other web applications for having central login system.

I put my script in /usr/lib/perl5/vendor_perl/5.8.7/RT and it works
correctly when I run it as root, but running it by Apache or other UNIX
users I get some errors.

Would someone tell me where should I add this file to @INC? or should I
import anything else in my script?

Here is my script:

use RT;
use RT::User;

Load the RT configuration

RT::LoadConfig();

Initialise RT

RT::Init();

my $u1 = RT::User->new($RT::SystemUser);
my ($id, $msg) = $u1->Create(Name => $ARGV[0], Password => $ARGV[1],
EmailAddress => $ARGV[2]);
print $msg."\n"

and the error message I get:

Can’t locate /etc/rt3/RT_Config.pm in @INC (@INC
contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/vendor_perl/5.8.7/RT.pm line
134.

Thanks,
Hamed

Hello,
I’ve written a small script that adds new users in command line to RT3,
which run by my other web applications for having central login system.

I put my script in /usr/lib/perl5/vendor_perl/5.8.7/RT and it works
correctly when I run it as root, but running it by Apache or other UNIX
users I get some errors.

Would someone tell me where should I add this file to @INC? or should I
import anything else in my script?

I bet that’s because /etc/rt3/RT_Config.pm is not readable by non-root
users… Check permissions on /etc/rt3 and /etc/rt3/RT_Config.pm. (Of
course, you may want to think twice about allowing non-root users read
RT configuration – DB passwords may want protecting).

  • Dmitri.