LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-26-2003, 11:15 AM   #1
dmaxj
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Rep: Reputation: 0
c programs and root user


I am writing some simple "Hello world" C code. I am logged in as the ROOT user. After I save the code, I compile the code (gcc <filename.c>). Next I try to execute the code (a.out <filename>), but I am then greeted with

'bash:aout is not a valid command or directory.'

Granted the code works fine when I log in as a regular user... What gives???


Thanks

Last edited by dmaxj; 06-26-2003 at 11:16 AM.
 
Old 06-26-2003, 11:51 AM   #2
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
the PATH environment variable typically associated with the root user differs slightly from that of an ordinary user.

the root PATH env variable will usually contain additional directories such as /sbin and /usr/sbin. Another major difference between root and user is that the user PATH variable includes the PWD in the path or the "./" entry meaning current directory.

root's PATH env variable does not contain ./ in its path.

so as root to execute a.out you will probably have to type it as such...

./a.out <filename>

hope that helps.
 
Old 06-26-2003, 11:54 AM   #3
dmaxj
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Original Poster
Rep: Reputation: 0
thanks

okay, I will try it... thanks for the insight...

Peace
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't launch programs as root Error1312 SUSE / openSUSE 3 02-10-2005 11:28 AM
running programs from root oscarp Linux - Software 2 09-17-2004 08:08 AM
cant start x programs when under root hylke Linux - Software 9 08-27-2004 10:07 AM
running programs as root marsques Linux - Newbie 5 08-15-2004 01:18 PM
Root can execute programs lawrencegoodman Linux - Newbie 11 01-28-2004 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration