[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with bash -- probably



jebstar@groupz.net wrote:...
  >I thought bash always prepended the pwd to the commands so that it 
  >would always find a shell script in the current directory.

bash doesn't do so by default; it uses the search path

  > In the 
  >.bash_profile for my user login shell, I set the path as follows:
  >
  >PATH='/usr:/bin:/usr/bin:/usr/sbin:.'
  >
  >The "." at the end was to try to ensure the current directory always 
  >got searched.
  >
  >When I try to run a Perl script in the current directory that starts 
  >with: 
  >
  >#!/usr/bin/perl5
  >
  >I get nothing if I'm running as a user.

Have you exported PATH?  If you don't, it won't be passed down to the perl
sub-shell.  You should say this when you set up your environment:

  export PATH=$PATH:.

(you include /usr/sbin in your path, which is normally for superuser only
commands; my version doesn't, unless /usr/sbin is put in at an earlier stage.)

  >                                 If I'm running su, then I get 
  >"command not found"

When you run su, you lose the PATH environment variable; that's to protect 
the system from having the superuser accidentally run a Trojan horse.
You should never have . in the path for the superuser.  As a result, the
interactive shell doesn't find the script in your current directory.

  >
  >If I type the full path name to the script in the current directory, 
  >then the perl scripts work as expected EXCEPT that any statement in 
  >the script that assumes the current working directory as the source 
  >fails.

This definitely seems to indicate that PATH is not exported.

  >
  >Is this a bug in Perl or bash? Is my environment set up wrong?
  >
  >Is there any place the overall organization of Debian is explained? 
  > 
  >Debian has taken pains to standardize a lot of things like 
  >configurations, but it really different from anything I've used 
  >before, and I've not found any documentation to explain it. 

Unfortunately, the new user documentation isn't written yet.

  >                                                     Simple 
  >things, like I want to login as 'root' vs. 'su' from a remote 
  >terminal. I'm sure there's a way to do this. I read the configuration 
  >files, but didn't see how to do this. 

In many cases, the system, by default, protects itself from actions which
could endanger it.  A remote root login means that you have no means of
tracing back who is responsible, whereas all su attempts are logged with
the user name responsible.  If you want to get the root login environment,
do `su -' instead of `su'.  If you really want to override this security,
edit /etc/securetty.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver

PGP key from public servers; key ID 32B8FAA1




--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: