how do I set 'home' for root

Erik Hemdal ehemdal at townisp.com
Wed Apr 27 21:24:53 UTC 2005


Also, I took a look at the two files but I can't interpret them - I'm 
reading
man Bash now, but, any suggestions on what I should be looking for? Here's
what they look like:

# .bash_profile

Name of this file, which is only run, or "sourced", at login, so once 
per session.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

The above command checks to see if the file /root/.bashrc exists in the 
user's home directory, and runs the file if it exists.  The .bashrc file 
can be unique for each user, so that individual users can customize 
their shells to their liking.  Everytime you open a new shell, this file 
is run, unlike .bash_profile.

# User specific environment and startup programs
PATH=$PATH:$HOME/bin

Change the $PATH variable so it includes everything it had before 
(possibly set  by what is in .bash_profile) and add the path /root/bin 
to it (assuming you're trying to run as root).  This would not work 
unless $HOME has a good value. 

export PATH

This makes the PATH visible to child shells that might be forked off 
when you execute a command, etc.

unset USERNAME

This removes the value of the shell variable $USERNAME so it has no value.

# .bashrc
# User specific aliases and functions
alias rm='rm -i'

This alias replaces the 'rm' command with 'rm -i', so that root will 
always be prompted before removing any file.  This is a safety precaution.

alias cp='cp -i'
alias mv='mv -i'

Same deal for the copy and move commands.  Since root can manipulate 
files for which he does not have explicit permission, he can do a lot of 
damage.  These aliases try to give you a little protection in case a 
typo causes you to work on files you don't intend.

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

This looks for a copy of a .bashrc file in the /etc directory.  The 
system administrator can use this file to set up shell-by-shell 
customizations that will take effect anytime a user starts a shell.  If 
this kind of shell code is used in every user's .bashrc, it can let the 
administrator make everyone's shells work in a consistent, customized way.

-- Claude Jones Bluemont, VA, USA

Hope this helps.  Write back for more, or contact me off list.  Erik Hemdal




More information about the users mailing list