Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #174286

Re: Trivial script will NOT execute

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups linux.debian.user
Subject Re: Trivial script will NOT execute
Date 2016-11-07 14:00 +0100
Message-ID <sARGT-3e5-37@gated-at.bofh.it> (permalink)
References <szXuW-Ff-1@gated-at.bofh.it> <szXEB-Xj-1@gated-at.bofh.it> <szY7D-16t-17@gated-at.bofh.it> <sAbod-1dk-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Nov 05, 2016 at 10:42:46AM -0500, David Wright wrote:
> The current working directory is included here three times???at the
> beginning, middle and end.
> 
> :/usr/bin::/bin:.

Including the current directory in one's PATH (either by using "."
explicitly, or by using an empty string) is considered a bad practice.
It opens you up to certain exploits by malicious users.

The classic example is that a malicious user puts a program named "sl"
in the /tmp directory, and waits for someone (preferably root) to
change directory to /tmp and then mistype "ls" as "sl".  This runs the
malicious user's program with the other user's privileges.

Thus, it's strongly recommended that you do *not* put the current
working directory into PATH.  If you need to execute a program in
the current directory, you can invoke it with a leading ./

./myscript

This bypasses the PATH lookup (because the command name contains a
slash character).  The leading "." is simply a directory name, not
anything magic to the shell.

> One other point. I see you use spaces in your filenames. Regardless of
> this, you should quote your strings in such as FILENAME=$F$N$E

In a simple assignment like that, you don't need to quote.  Word
splitting and pathname expansion are not performed, for legacy
reasons.  However, quoting doesn't hurt.

http://mywiki.wooledge.org/Quotes

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Trivial script will NOT execute Richard Owlett <rowlett@cloud85.net> - 2016-11-05 02:00 +0100
  Re: Trivial script will NOT execute "John L. Ries" <jries@salford-systems.com> - 2016-11-05 02:10 +0100
    Re: Trivial script will NOT execute Richard Owlett <rowlett@cloud85.net> - 2016-11-05 02:40 +0100
      Re: Trivial script will NOT execute "John L. Ries" <jries@salford-systems.com> - 2016-11-05 04:30 +0100
      Re: Trivial script will NOT execute David Wright <deblis@lionunicorn.co.uk> - 2016-11-05 16:50 +0100
        Re: Trivial script will NOT execute Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-07 14:00 +0100
          Re: Trivial script will NOT execute David Wright <deblis@lionunicorn.co.uk> - 2016-11-07 14:50 +0100
  Re: Trivial script will NOT execute Christian Seiler <christian@iwakd.de> - 2016-11-05 02:20 +0100
    Re: Trivial script will NOT execute Ben Caradoc-Davies <ben@transient.nz> - 2016-11-05 04:00 +0100
  Re: Trivial script will NOT execute sunrise@mailbug.com - 2016-11-05 02:40 +0100

csiph-web