cancel
Showing results for 
Search instead for 
Did you mean: 

ping

 
Highlighted
Contributor

ping

HP 9000 ,HP-UX 10.20

When I run command ping
under any user (except root)
,the following message display "sh: ping :not found"
What should I do ?
9 REPLIES 9
Highlighted
Honored Contributor

Re: ping

The command "ping" is located in /usr/sbin. That directory is not normally listed in PATH for normal users, only for root.

(PATH is an environment variable that lists all the directories the shell searches for executable commands. To examine the value of the variable, run "echo $PATH". The default value for PATH is defined in the /etc/PATH file.)

As a normal user, you can run ping by specifying the full name:

/usr/sbin/ping

MK
MK
Highlighted
Honored Contributor

Re: ping

Hi

Open user's .profile add the following entry, save&exit

alias ping='/usr/sbin/ping'

Best Regards
Murat
Murat Suluhan
Highlighted
Honored Contributor

Re: ping

Atef,

you can use full path /usr/sbin/ping to execute the ping command.

WK
Problem never ends, you must know how to fix it
Highlighted
Honored Contributor

Re: ping

There is also a link to 'ping' in /etc. For example, you can do:

$ /etc/ping
Highlighted
Acclaimed Contributor

Re: ping

>(except root)

While root you should have used "whence ping" to find its absolute path.
You can also find ping by its tlink: /etc/ping
Highlighted
Honored Contributor

Re: ping

>...(except root)

The location of the ping program in /usr/sbin
is for good reason because only a privileged user is allowed to generate ICMP echo-request packets.
As you can see the program is owned by root and has the suid bit set (one of the few commands on a Unix system) so that every user can execute this command with the effective uid of root.

$ ll /usr/sbin/ping
-r-sr-xr-x 1 root bin 32768 Oct 17 2006 /usr/sbin/ping
Madness, thy name is system administration
Highlighted
Honored Contributor

Re: ping

hi,

To determine which path is used for ping in the other profile, you can run either of the following commands:

server1: home/yogeeraj>whereis ping
ping: /usr/sbin/ping /usr/share/man/man1m.Z/ping.1m

or

server1: home/yogeeraj>which ping
/usr/sbin/ping
server1: home/yogeeraj>


You can then amend the PATH environment variable for root accordingly.

Similarly if you find any other commands that are not working, you can proceed in the same way.

hope this helps too!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Highlighted
Advisor

Re: ping

atef,


Open users .profile and append the following at PATH line

:/usr/sbin

Shree
Highlighted
Honored Contributor

Re: ping

Regarding Shreekanth's suggestion: there are things in /usr/sbin you would not want ordinary users to run, so I would advise against putting it in their path. The earlier suggestion of an alias is safer.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing