Ticket #920 (closed defect: duplicate)

Opened 10 years ago

Last modified 9 years ago

Prevent users from doing stupid things with PATH

Reported by: jdreed Owned by:
Priority: normal Milestone: Precise Beta
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

There's a bad snippet of code (that appears to be from 6.170) going around that encourages users to do this:

setenv PATH .:${JAVA_HOME}

And of course all the login scripts fail and they can't log in (because gnome-session isn't in PATH). After .environment and .cshrc.mine (or their bash equivalents) are sourced in the Athena dotfiles, we should sanity-check path and make sure /bin and /usr/bin are in there. At that point, we have two options:

  • append them to $PATH (frankly, I can't think of a legitimate reason to have /usr/bin and /bin not present in your PATH at all -- I can think of reasons for them to be at the end, but not absent)
  • Popup a zenity dialog telling the user that they're Wrong(tm) and pointing them at a Hermes article.

Change History

comment:1 Changed 10 years ago by jdreed

Off the top of my head:

MISSING=
for p in /bin /usr/bin; do
 echo $PATH | /usr/bin/tr ':' '\n' | /bin/grep "^${p}$
 if [ $? != 0 ]; then
   MISSING="$MISSING $p"
 fi
done
if [ -n "$MISSING" ]; then
   echo "Your PATH is missing \"$MISSING\" and this login session will break."
fi

comment:2 Changed 10 years ago by jdreed

Geoff suggests we can just "add /bin /usr/bin" which is fine with me.

comment:3 Changed 9 years ago by jdreed

  • Status changed from new to closed
  • Resolution set to duplicate

See #1110

Note: See TracTickets for help on using tickets.