*BSD News Article 59771


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.bhp.com.au!mel.dit.csiro.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!newsfeed.internetmci.com!info.ucla.edu!library.ucla.edu!news.ucdavis.edu!not-for-mail
From: obrien@cs.ucdavis.edu (David E. O'Brien)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: New User's Book
Date: 16 Jan 1996 11:06:44 GMT
Organization: University of California, Davis
Lines: 28
Message-ID: <4dg0s4$pjp@mark.ucdavis.edu>
References: <4dfu0h$mu4@news.mel.aone.net.au>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]

Alan Ruedlinger (alan@s056.aone.net.au) wrote:
: 'Hello world!" straight from a book on C, but it won't run :(  I've
: compiled it by typing "gcc -v hello.c"; an a.out file is created but
: when I type a.out, FreeBSD tells me something like 'command not found'
: (incidentally, I tried this on a linux machine and it worked first go


If you are running as root I can easily explain this.  Issue ``echo $PATH''
and you will see something simular to:

    /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin

which as you can see does NOT specify the local directory (specified by a
single dot (i.e. ``.'').  Under the Linux box you must have had something
like:

    /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:.

The reasons for this are security.  When running as the root user you
should know *exactly* what file you are executing.  Otherwise I can install
a neet trojan real easily.  Say I create a neat new ``ls'' command and
place it in my home directory.  I ask Mr. root to cd to my home directory
because I have some trouble with my files.  Mr. root does ``ls'' and I
might just wind up with root priviledges myself!

For mear mortals this isn't as important.

-- David   (obrien@cs.ucdavis.edu)