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
# 1  
Old 10-16-2012
How to add path to root user

I am trying to add path for root.
In /etc directory there is no .bash_profile file
it has only profile file
can any one say how to add path for root user ?
is it possible to add path in profile file for root user.
# 2  
Old 10-16-2012
There should be a file .bash_profile in root's home directory. You can put your PATH modifications there.
# 3  
Old 10-16-2012
How to add path to root user

i tried to find .bash_profile file home directory.
i can see only .bashrc file will be there.
in .bashrc file can we add path for root?
# 4  
Old 10-16-2012
If .bash_profile is not there, just create the file. I wouldn't use .bashrc for this, because .bash_profile is executed only by a login shell, whereas .bashrc is executed by all subshells too.
# 5  
Old 10-16-2012
how to create .bash_profile

Thanks for the reply.
can you guide me how to create .bash_profile

Code:
# .bash_profile  # Get the aliases and functions if [ -f ~/.bashrc ]; then         . ~/.bashrc fi  # User specific environment and startup programs  PATH=$PATH:$HOME/bin:. BASH_ENV=$HOME/.bashrc USERNAME="root"  export USERNAME BASH_ENV PATH

please tell me this is enough
is it for only root or for all user?

---------- Post updated at 01:48 PM ---------- Previous update was at 01:37 PM ----------

I forget to say one thing
currently i am getting following path.
Code:
/usr/sbin:/bin:/usr/bin:/sbin

along with this i want to add one more path then where i need to add new path.
thanks in advance.Smilie
# 6  
Old 10-16-2012
If the file is in root's home directory, the file is only valid for root. The file you posted looks right, besides the formatting issue. It is the default .bash_profile file. Just edit the one line, where PATH ist set to something like:

Code:
...
PATH=$PATH:/the/path/you/want/to/append
...

# 7  
Old 10-16-2012
How to add path to root user

i created file .bash_profile and kept in root's home directory.
then i executed the file,after that the following path got added.
Code:
/usr/sbin:/bin:/usr/bin:/sbin:/opt/ubersvn:ubersvn/bin:.

but i trying to execute the command
Code:
svn help

but its not executing
if i maually exported means its working.

after i login again,it showing previous path only.
Code:
/usr/sbin:/bin:/usr/bin:/sbin

so its not executing automatically for every login also
if i execute manually then path getting added
but no use with that path

so what you think on this
 
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