1830360 Members
2440 Online
110001 Solutions
New Discussion

Why

 
atef_3
Contributor

Why

when I append :/sbin/usr to variable PATH in .profile file for any user (other than root) ,I became able to run all the commands
but from root user shell
then run command (su - username)
then run any command
but when I enter to computer under other user
I can not run any command ?
7 REPLIES 7
Jeeshan
Honored Contributor

Re: Why

Hi

Change the .profile by the following entry and remove your entry

PATH=$PATH:/sbin/usr

then login su or direct login

a warrior never quits
Torsten.
Acclaimed Contributor

Re: Why

If you are using CDE, have a look at

.dtprofile

...
#
# If $HOME/.profile (.login) has been edited as described above, uncomment
# the following line.
#
# DTSOURCEPROFILE=true

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Kapil Jha
Honored Contributor

Re: Why

>>>but from root user shell
>>>then run command (su - username)
>>>then run any command
>>>but when I enter to computer under other user

I did not understand ur problem :(
Please elaborate...
I am in this small bowl, I wane see the real world......
atef_3
Contributor

Re: Why

Under user other than root ,To run commands such as (ping,telnet,....)
I must change variable PATH . So I changed .profile as
(PATH=$PATH:/usr/sbin:.)
But there are two cases :-
1)-Under user other than root I must
run .profile to run commands (ping,...)
2)-Login to user via root when run
command (su - username)
I can run commands (ping,...)directly
without need to run .profile

(Why ????)

Thank you,,
Jeeshan
Honored Contributor

Re: Why

Hi

the other solution is SUDO

You can run such commands without su is sudo.

This will be very much effective to trace.
a warrior never quits
Steven Schweda
Honored Contributor

Re: Why

First, it would be nice if you chose subjects
more informative than "Why" or "Route".

> I can not run any command ?

What does this mean? What, exactly, do you
do, and what, exactly, happens when you do
it?

> [...] So I changed .profile as
> (PATH=$PATH:/usr/sbin:.)

Whose .profile? You didn't actually use the
parentheses ("()"), did you? What _is_ your
PATH in all these cases?

echo $PATH

> [...] when I enter to computer under other
> user

You mean like Telnet, and log in as a
non-root user?

ls -l .profile

What is the user's shell? (Changing .profile
may not do much for a C shell user.)
Dennis Handly
Acclaimed Contributor

Re: Why

>Under user other than root, to run commands such as (ping, telnet,....). I must change variable PATH .

(To me, it isn't worth doing that, so I always use the absolute path.)

>So I changed .profile as (PATH=$PATH:/usr/sbin:.)

That seems right.

>1)-Under user other than root I must run .profile to run commands (ping,...)

Of course. You must either re-login or you must source .profile to get the changes there.

>2)-Login to user via root when run command (su - username)

This (-) will read .profile. So will using login.

>I can run commands (ping,...) directly without need to run .profile

If you change .profile, you must somehow read it. But you only need to do this once, per login session.