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
On Wed, 2005-04-27 at 17:24 -0400, Erik Hemdal wrote:
# .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.
But a very unwise safety precaution, especially for a root user. People that have this alias get used to it being there, and can end up doing something like "rm *" when they want to remove several files, answering "y" or "n" to each file. Trouble is, some day they will do this on a system that doesn't have the alias set up... and it might be their own system if their .bashrc got corrupted. And then they'd delete all their files before they realised what had happened. So I would advise strongly against using an alias like this.
Paul.
On Wednesday 27 April 2005 05:34 pm, Paul Howarth wrote:
On Wed, 2005-04-27 at 17:24 -0400, Erik Hemdal wrote:
# .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.
But a very unwise safety precaution, especially for a root user. People that have this alias get used to it being there, and can end up doing something like "rm *" when they want to remove several files, answering "y" or "n" to each file. Trouble is, some day they will do this on a system that doesn't have the alias set up... and it might be their own system if their .bashrc got corrupted. And then they'd delete all their files before they realised what had happened. So I would advise strongly against using an alias like this.
Paul.
Paul Howarth paul@city-fan.org
It would be wise to also "chattr" important files that won't be changed often.
On rm "y" or "n" , I have hit "y" instead of "n" too many times to count.
Erik Hemdal wrote:
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
Thanks to Claude for asking the questions and to Erik for his informative response.
On Wednesday April 27 2005 5:24 pm, Erik Hemdal wrote: --------------------snip-----------------------long explanation of two files
Hope this helps. Write back for more, or contact me off list. Erik Hemdal
Thank you very much, for your explanation, and your offer. I'm doing a lot of reading now - these crises always serve to force-feed intense learning curves. Thanks to Alexander also, and everyone else who responded. Things are either working now, or can be made to work through workarounds.
On Wednesday April 27 2005 5:53 pm, Claude Jones wrote:
On Wednesday April 27 2005 5:24 pm, Erik Hemdal wrote: --------------------snip-----------------------long explanation of two files
Hope this helps. Write back for more, or contact me off list. Erik Hemdal
Thank you very much, for your explanation, and your offer. I'm doing a lot of reading now - these crises always serve to force-feed intense learning curves. Thanks to Alexander also, and everyone else who responded. Things are either working now, or can be made to work through workarounds. --
Just when I thought I had this under control, I find a new issue. Apparently, by logging in as single user, and setting a new password, I set a password with an extremely short time-to-live. I just tried to switch to root and I am being informed that my password has expired! I just reset it yesterday. So, what's the correct procedure, here? Log in as single user again, I guess, reset the password, then.... How do I make it last more than 24 hours?