Cannot run commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cannot run commands
# 1  
Old 03-11-2008
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  
Old 03-11-2008
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  
Old 03-12-2008
Quote:
Originally Posted by ShawnMilo
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  
Old 03-12-2008
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  
Old 03-12-2008
Quote:
Originally Posted by BigTool4u2
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
# 6  
Old 03-12-2008
Quote:
Originally Posted by andryk
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.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run 2 exec commands

I have to create two instances of jBoss 5.1.0 GA. In order to do that I have to execute the following in start-jboss.sh: find . -exec /opt/novell/idm/jboss/bin/run.sh -Djboss.service.binding.set=ports-01 -c IDMProv -b 0.0.0.0 \; -exec /opt/novell/idm/jboss/bin/run.sh... (4 Replies)
Discussion started by: Joydeep Ghosh
4 Replies

2. Shell Programming and Scripting

Run multiple commands in ssh

Hi All, I have the below requirement. I want to copy the local file to remote after that i need to run the local script on a remote machine.When i use two ssh commnds i can achieve this. But i want to achieve this using one ssh command. Below command to copy the local file to remote ssh -q... (2 Replies)
Discussion started by: mohanalakshmi
2 Replies

3. Shell Programming and Scripting

Run commands in a script in different shells

Hi to all, i have the following problem... i want to run three commands in a script in different shells... the first command is running always and is needed for the second on to run properly... example # Procedure 1 xterm -e exec1 arg1 arg2 # Procedure 2 xterm -e exec2 arg1 arg2 #... (6 Replies)
Discussion started by: paladinaeon
6 Replies

4. UNIX for Dummies Questions & Answers

Run multiple commands

Hi All, Is it possible to run second/multiple commands at a time in script before the completion/return of first command? Pls reply. (5 Replies)
Discussion started by: cns1710
5 Replies

5. HP-UX

Unable to run some commands in HP-UX

Hi All, I want to get %cpu and %memory utilization for a given process id in HP-UX so am using the following commands 1)TOP -p <PID> am getting error message like Quitting top: pset 26323 doesn't exist,but when am using only TOP command without any options its working fine. 2)ps -e -o pcpu... (5 Replies)
Discussion started by: Ramya_Nm
5 Replies

6. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

7. Shell Programming and Scripting

Run several commands at a time

Hello guys, I am new at shell scripting and I want to create a script that runs several commands at a time, ie: uptime, w, df -h and so on and send the output of this commands to a text file so it can be send via email at a certain time using crontab. Any help will be much appreciated! (4 Replies)
Discussion started by: agasamapetilon
4 Replies

8. Shell Programming and Scripting

run commands from a variable

I have a question of how to run commands from a variable where there are more than one commands in the variable under bash. I ran the following commands under bash > command="ls /etc/zshrc; ls /etc/zshenv" > $command The results were: ls: /etc/zshrc;: No such file or directory ls: ls:... (1 Reply)
Discussion started by: pankai
1 Replies

9. UNIX for Dummies Questions & Answers

run commands before login

What would be the best way to setup for a Linux box to run a few commands before the user logs in? (1 Reply)
Discussion started by: woofie
1 Replies

10. IP Networking

Run commands on a UNIX with NT

Hi I'm trying to automatically run a command on a UNIX (AIX) machine from a Windows NT 4 machine. I can do this manually using the 'rexec' or 'rsh' command but I need an automatic login (on the AIX). In the manual I've found that there should be a '.rhosts' file on the Unix machine in the... (1 Reply)
Discussion started by: Mark Detrez
1 Replies
Login or Register to Ask a Question