"which perl": Different for root and users

S

sdfgsd

Hello again,

Just solved one set of problems with a 5.8.0 => 5.8.3 upgrade and now I have
another:

When I type 'which perl' I get '/usr/local/bin/perl' for users and
'/usr/bin/perl' for root! Is this a Suse/Linux issue or a Perl issue? I've
googled, perldoc'ed and still can't figure this out.

Incidently, my new Perl executable (compiled as root) is in /usr/bin and
user scripts still want /usr/local/bin/perl even when I place
'#!/usr/bin/perl' at the top of the script.
 
A

Anno Siegel

sdfgsd said:
Hello again,

Just solved one set of problems with a 5.8.0 => 5.8.3 upgrade and now I have
another:

When I type 'which perl' I get '/usr/local/bin/perl' for users and
'/usr/bin/perl' for root! Is this a Suse/Linux issue or a Perl issue? I've
googled, perldoc'ed and still can't figure this out.

It's a Unix issue.
Incidently, my new Perl executable (compiled as root) is in /usr/bin and
user scripts still want /usr/local/bin/perl even when I place
'#!/usr/bin/perl' at the top of the script.

Presumably users have /usr/local/bin before /usr/bin on their path, and
root hasn't. This is as it should be. In fact, it isn't a bad idea to
keep root's perl separate and not have it hop along with every version
change.

Anno
 
A

Anno Siegel

sdfgsd said:
Hello again,

Just solved one set of problems with a 5.8.0 => 5.8.3 upgrade and now I have
another:

When I type 'which perl' I get '/usr/local/bin/perl' for users and
'/usr/bin/perl' for root! Is this a Suse/Linux issue or a Perl issue? I've
googled, perldoc'ed and still can't figure this out.

It's a Unix issue.

Presumably users have /usr/local/bin before /usr/bin on their path, and
root hasn't. This is as it should be. In fact, it isn't a bad idea to
keep root's perl separate and not have it hop along with every version
change.
Incidently, my new Perl executable (compiled as root) is in /usr/bin and
user scripts still want /usr/local/bin/perl even when I place
'#!/usr/bin/perl' at the top of the script.

I don't understand what you are saying.

Anno
 
S

sdfgsd

Anno Siegel said:
It's a Unix issue.

Presumably users have /usr/local/bin before /usr/bin on their path, and
root hasn't. This is as it should be. In fact, it isn't a bad idea to
keep root's perl separate and not have it hop along with every version
change.


I don't understand what you are saying.

Scripts run by users don't execute because there is no longer a Perl
executable in /usr/local/bin. In order for me to run the scripts, I need to
be root!

It does sound like a Linux path issue and I will pursue that line, but if
you have any add'l thoughts on this, I'd sure like to hear them. Thanks for
your reply.
 
J

John W. Krahn

sdfgsd said:
Scripts run by users don't execute because there is no longer a Perl
executable in /usr/local/bin. In order for me to run the scripts, I need to
be root!

It does sound like a Linux path issue and I will pursue that line, but if
you have any add'l thoughts on this, I'd sure like to hear them. Thanks for
your reply.

Make /usr/local/bin/perl a symlink to the perl executable you want the
users to use.


John
 
D

David Efflandt

Make /usr/local/bin/perl a symlink to the perl executable you want the
users to use.

I originally created that symlink in Linux (which by default is
/usr/bin/perl) so scripts written for a Solaris server at my ISP would
work (default /usr/local/bin/perl). But the path to Perl should be in the
shebang line anyway (first line of script) so it is correct for the
system it is running on. This was especially true when systems had perl4
and Perl5 (and true at my ISP which now has a newer 5 version in
/usr/bin). I also have to remember to change the shebang line for NetBSD
to /usr/pkg/bin/perl.
 
S

sdfgsd

John W. Krahn said:
Make /usr/local/bin/perl a symlink to the perl executable you want the
users to use.

This is probably the best solution until I figure out what's going on
underneath it all. Thanks for the reply.
 
L

Lack Mr G M

|>
|> Presumably users have /usr/local/bin before /usr/bin on their path, and
|> root hasn't. This is as it should be.

I disagree.

|> In fact, it isn't a bad idea to
|> keep root's perl separate and not have it hop along with every version
|> change.

Well, I'd agree with that, but the same applies to non-root users.

It really depends on what is in /usr/local and who can put things
there. If it is only root-writable then it makes sense for everyone to
have it in their PATH (in the same relative location).

If you can make the root environment as similar as possible to a
normal user environmentthen you will have fewer admin problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,147
Messages
2,570,833
Members
47,380
Latest member
AlinaBlevi

Latest Threads

Top