The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
code that reads commands from the standard i/p and executes the commands Phrozen Smoke High Level Programming 4 01-22-2007 02:06 AM
need help with some commands please mujtba UNIX for Dummies Questions & Answers 2 01-14-2005 02:49 PM
sed commands dbrundrett Shell Programming and Scripting 7 09-28-2004 06:11 PM
commands kironpmullamkuz Security 2 06-28-2002 12:45 AM
BDS Commands bbutler3295 UNIX for Dummies Questions & Answers 3 03-04-2002 08:28 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-11-2008
BigTool4u2 BigTool4u2 is offline
Registered User
  
 

Join Date: Nov 2002
Location: London
Posts: 31
Cannot run commands

It would be helpful if someone could help me out here. The problem I have been having is that I cannot run some commands which are valid - whenever I try to run the command I get the message "command not found". Now, if I run the same command as root it executes. These commands do not have to be run as root for it to be executed, for example, if I run 'sysdef', 'prtconf' and even 'ifconfig' command I get the command not found message.

How can I get around this issue this issue?

I am running an Solaris 10 on an x86 architecture.

Rgds.
  #2 (permalink)  
Old 03-11-2008
ShawnMilo ShawnMilo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 252
Root has things in its path that the normal user doesn't. So, as root, if you can run a program named sysdef, run this command: which sysdef

The response will be something like: /sbin/sysdef

If the application truly doesn't require root permissions, then you should be able to run it as a regular user by typing in the full path: /sbin/sysdef

If this works, you can alias the command: alias sysdef="/sbin/sysdef"

You should then be able to run it by just typing the name. If that works, you could consider adding that alias command to your ~/.bashrc (for bash -- research the proper location for other shells), for your convenience.

ShawnMilo
  #3 (permalink)  
Old 03-12-2008
BigTool4u2 BigTool4u2 is offline
Registered User
  
 

Join Date: Nov 2002
Location: London
Posts: 31
Quote:
Originally Posted by ShawnMilo View Post
Root has things in its path that the normal user doesn't. So, as root, if you can run a program named sysdef, run this command: which sysdef

The response will be something like: /sbin/sysdef

If the application truly doesn't require root permissions, then you should be able to run it as a regular user by typing in the full path: /sbin/sysdef

If this works, you can alias the command: alias sysdef="/sbin/sysdef"

You should then be able to run it by just typing the name. If that works, you could consider adding that alias command to your ~/.bashrc (for bash -- research the proper location for other shells), for your convenience.

ShawnMilo
ShawnMilo, thanks for your input.

Under the normal user account I did the 'which sysdef' and I got the output 'no sysdef in /usr/bin /usr/openwin/bin /usr/ucb'. So I ran the same command as root and I got '/usr/bin/sysdef'. From my understanding of that it's is showing me that the sysdef files are located in the /usr/bin. What I attempted to do next was to create a soft link between the sysdef in the /usr/bin to the /usr/bin/local; I found out that the sysdef files are not in there. The command I used for that is "ln -s /usr/sbin/sysdef /usr/local/bin/sysdef". Had a look in the /usr/bin/local and the sysdef was there. Tried to run the sysdef command as the normal user and still got nothing 'command not found'. Have I attempted to go about this the wrong way. My knowledge of Unix is very rudimentary so if someone could point out where I am going wrong I would be more than grateful.

Rgds,
Everett
  #4 (permalink)  
Old 03-12-2008
andryk's Avatar
andryk andryk is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2003
Posts: 448
Hi,
Without using softlink you could as root get PATH values
Code:
# echo $PATH
then back to normal user, update your current PATH
Code:
$ export PATH=$PATH:_values_you_got_from_root
and if it works you could update your login profile as well...
  #5 (permalink)  
Old 03-12-2008
BigTool4u2 BigTool4u2 is offline
Registered User
  
 

Join Date: Nov 2002
Location: London
Posts: 31
Quote:
Originally Posted by andryk View Post
Hi,
Without using softlink you could as root get PATH values
Code:
# echo $PATH
then back to normal user, update your current PATH
Code:
$ export PATH=$PATH:_values_you_got_from_root
and if it works you could update your login profile as well...
Thanks, I tried this method and it worked.

Thanks for helping out.
  #6 (permalink)  
Old 03-12-2008
ShawnMilo ShawnMilo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 252
Quote:
Originally Posted by BigTool4u2 View Post
ShawnMilo, thanks for your input.

Under the normal user account I did the 'which sysdef' and I got the output 'no sysdef in /usr/bin /usr/openwin/bin /usr/ucb'. So I ran the same command as root and I got '/usr/bin/sysdef'. From my understanding of that it's is showing me that the sysdef files are located in the /usr/bin. What I attempted to do next was to create a soft link between the sysdef in the /usr/bin to the /usr/bin/local; I found out that the sysdef files are not in there. The command I used for that is "ln -s /usr/sbin/sysdef /usr/local/bin/sysdef". Had a look in the /usr/bin/local and the sysdef was there. Tried to run the sysdef command as the normal user and still got nothing 'command not found'. Have I attempted to go about this the wrong way. My knowledge of Unix is very rudimentary so if someone could point out where I am going wrong I would be more than grateful.

Rgds,
Everett
Please re-read my last post. I wasn't talking about creating symlinks. Just add aliases to your environment in your .rc file, or see andryk's suggestion about modifying your path, which you can also add to your .rc file (.bashrc or similar).

I don't think it's a good idea to arbitrarily add symlinks into system directories, such as /usr/local/bin, but I could be wrong.

ShawnMilo
Closed Thread

Bookmarks

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0