How to add path to root user


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to add path to root user
# 15  
Old 10-16-2012
Well you did not say what was your OS... but I find it interesting... I would have done the same... maybe more nasty, not allow you to use root anymore...
# 16  
Old 10-16-2012
Quote:
Originally Posted by elango963
yes working in bash only
see below:
Code:
UID        PID  PPID  C STIME TTY          TIME CMD
root     32591 32590  0 16:50 pts/1    00:00:00 bash

I just noticed the command-name is just bash. It should be -bash for a login-shell (with a leading dash).

What does
Code:
getent passwd root

print? Don't worry you will not give away your root-password. The expected output is something like
Code:
root:x:0:0:Super-User:/root:/bin/ksh

If the last field does not end with "bash", like in my example, your login shell is not bash and then it's clear, why .bash_profile is not executed.
# 17  
Old 10-17-2012
How to add path to root user

Hi hergp
following result i got for
Code:
getent passwd root

Code:
root:x:0:0:root:/root:/bin/bash

one more thing i want to ask
i just created .bash_profile but i didn't give any permission like execute.
is .bash_profile requires any permission.
# 18  
Old 10-17-2012
.bash_profile does not need execute-permissions, because it is not executed, but included by your shell. So read/write access for root is sufficient.

Another idea: please move the PATH=... statement from .bash_profile to .bashrc and check, if this does any good. For some reason, it looks, as if your shell is not a login shell. But since .bashrc is read by all (bash)-shells, not only the login shell, this might solve your problem.
# 19  
Old 10-17-2012
If you are accessing the shell through a terminal emulator program then your shell is a non-login interactive shell (in most cases). You could set the PATH in your .bashrc. Some terminal emulators have a setting where each instance of a new window will produce a login interactive shell. In this case you would set the PATH in .bash_profile.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to give root access to non root user?

Currently in my system Red Hat is installed. And Many user connect to my machine via SSH Techia Terminal. I want to give some users a root level access. Can anyone please help me how to make it possible. I too searched on the Google but didn't find the correct way Regards ADI (4 Replies)
Discussion started by: adisky123
4 Replies

2. UNIX for Advanced & Expert Users

Root and non-root user not able to delete the file

Hi!! one strange problem occurred with my RHEL 5 box. i'm having logs folder with ownership of non-root user. Created some files with root user under logs folder. here is the scene: -rw-r----- 1 root root 1048227 Feb 28 12:34 SystemOut_13.02.28_12.34.10.log -rw-r----- 1 root root ... (6 Replies)
Discussion started by: sukhdip
6 Replies

3. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

4. Solaris

add PATH as root

Sorry this maybe a dumb one, but I am root and want to add something to my PATH. Is the right place to do it here: /usr/dt/config/dtspcdenv ? If so, after I add it, how do I source it? Neither "source <file>" nor ". <file>" work. How does the above file work... is there another... (5 Replies)
Discussion started by: steve701
5 Replies

5. Solaris

cannot add PATH to user crontab file

hi All, here is the problem: I'm not able to specify a PATH inside the user crontab file (/var/spool/cron/crontabs). The only syntax it accepts is the usual "* * * * * file" I'm not able to add PATH, or HOME, or MAILTO, or anything else. when I try to save the crontab, I have the error: ... (1 Reply)
Discussion started by: joe_x
1 Replies

6. Shell Programming and Scripting

Appending a path in user's PATH variable

Hello Folks, I want to append a path in user's PATH variable which should be available in current session. Background Numerous persons will run a utility. Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

7. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

8. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

9. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies

10. UNIX for Dummies Questions & Answers

mistyped shell path, now i can't login as the only user that can su to root

i mistyped the location of bash and now i can't login as the only other user who belongs to wheel on my freebsd box. since i'm having many problems with samba, this has frozen my attempts to get things resolved with the former issue. i've been told that 'su -m' should do the trick, but it's... (3 Replies)
Discussion started by: xyyz
3 Replies
Login or Register to Ask a Question