I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
Anne
On Sat, Nov 8, 2008 at 10:57 AM, Anne Wilson cannewilson@googlemail.com wrote:
I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
Try /etc/profile.
mhr
On Saturday 08 November 2008 19:00:12 MHR wrote:
On Sat, Nov 8, 2008 at 10:57 AM, Anne Wilson cannewilson@googlemail.com
wrote:
I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
Try /etc/profile.
That doesn't appear to define cp, l, ll, ls, mv, rm or which, all of which are listed by the command 'alias'.
Anne
On Sat, 2008-11-08 at 18:57 +0000, Anne Wilson wrote:
I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
~/.bashrc
FTR, you can use \cp to get around this.
On Saturday 08 November 2008 19:00:56 Ignacio Vazquez-Abrams wrote:
On Sat, 2008-11-08 at 18:57 +0000, Anne Wilson wrote:
I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
~/.bashrc
That seems to be the place to add user-specific ones, but where are the global default ones?
FTR, you can use \cp to get around this.
I was told that, and also told that it was advisable to use the full path in a script, particularly if it is to be run by cron. I chose the full-path solution.
Anne
On Sat, 2008-11-08 at 19:39 +0000, Anne Wilson wrote:
That seems to be the place to add user-specific ones, but where are the global default ones?
All global default files are in /etc/skel.
On Sat, 2008-11-08 at 19:39 +0000, Anne Wilson wrote:
On Saturday 08 November 2008 19:00:56 Ignacio Vazquez-Abrams wrote:
On Sat, 2008-11-08 at 18:57 +0000, Anne Wilson wrote:
I was having a problem in a shell script that turned out to be cp being aliased to 'cp -i'. Not a showstopper, once you realise it, but it did beg the question as to where this file is. I was told to look in /etc/profile.d, but that doesn't seem to be the case on my CentOS box. I can list aliases, so I know the file exists, but where?
~/.bashrc
That seems to be the place to add user-specific ones, but where are the global default ones?
/etc/bashrc
But be aware that root-specific ones are here on 5.x
# grep alias .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
FTR, you can use \cp to get around this.
I was told that, and also told that it was advisable to use the full path in a script, particularly if it is to be run by cron. I chose the full-path solution.
Unambiguity is _always_ preferred if security is a primary issue. Anytime higher privileges are involved, that should be a high-priority issue.
Anne
<snip sig stuff>
On Saturday 08 November 2008 20:38:43 William L. Maltby wrote:
/etc/bashrc
But be aware that root-specific ones are here on 5.x
# grep alias .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
I'm sorry, but I just can't understand why I can't find these
Anne
I'm sorry, but I just can't understand why I can't find these
Anne
[root@proxy ~]# pwd /root [root@proxy ~]# cat .bashrc # .bashrc
# User specific aliases and functions
alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi [root@proxy ~]#
On Sat, 2008-11-08 at 22:02 +0000, Anne Wilson wrote:
On Saturday 08 November 2008 20:38:43 William L. Maltby wrote:
/etc/bashrc
But be aware that root-specific ones are here on 5.x
# grep alias .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
I'm sorry, but I just can't understand why I can't find these
Local mods somewhere in the past? Missed update?
# lsb_release LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
# cat /etc/redhat-release CentOS release 5.2 (Final)
Corruption? Have you done an rpm --verify? Have you done an updatedb and locate for rpmsave and rpmnew? Those are all I can think of.
Keep in mind that when you login, various config/init files are used by bash, depending on normal operation or not. I've not examined all the below, but nothing else catches my eye as "The Usual Suspects" (TM).
# ls -ld /etc/*prof* /etc/*bash* drwxr-xr-x 2 root root 4096 Sep 17 06:00 /etc/bash_completion.d -rw-r--r-- 1 root root 1437 Nov 28 2006 /etc/bashrc drwxr-xr-x 2 root root 4096 Nov 10 2007 /etc/desktop-profiles -rw-r--r-- 1 root root 937 Jan 31 2006 /etc/profile drwxr-xr-x 2 root root 4096 Oct 13 16:16 /etc/profile.d -rw-r--r-- 1 root root 32 Jan 3 2008 /etc/yumex.profiles.conf
]# grep -irl alias /etc/*prof* /etc/*bash* /etc/profile /etc/profile.d/colorls.csh /etc/profile.d/vim.csh /etc/profile.d/colorls.sh /etc/profile.d/nvidia.sh /etc/profile.d/vim.sh /etc/profile.d/which-2.sh /etc/profile.d/nvidia.csh /etc/bashrc
In /etc/passwd, add the "-x" flag to the end of the root line and you should see all executed commands.
Anne
<snip sig stuff>
HTH
Anne Wilson wrote:
On Saturday 08 November 2008 20:38:43 William L. Maltby wrote:
/etc/bashrc
But be aware that root-specific ones are here on 5.x
# grep alias .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
I'm sorry, but I just can't understand why I can't find these
bash runs...
/etc/profile /etc/bashrc and $HOME/.bash_profile or $HOME/.bash_login or $HOME/.profile
upon starting a login shell...
the standard supplied profiles by default also run
/etc/profile.d/*.sh $HOME/.bashrc
and this last runs
/etc/bashrc
I note that the commands you're seeing are aliased explicitly in
/root/.bashrc
[root@freescruz ~]# cat /root/.bashrc # .bashrc
# User specific aliases and functions
alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
by default in most every RH system I checked, from the above CentOS 5 all the way back to RH Linux 6.2
[root@hogranch /root]# ls -la .bashrc -rw-r--r-- 1 root root 176 Aug 23 1995 .bashrc [root@hogranch /root]# rpm -qf .bashrc rootfiles-5.2-5 [root@hogranch /root]# rpm -qi rootfiles Name : rootfiles Relocations: (not relocateable) Version : 5.2 Vendor: Red Hat Software Release : 5 Build Date: Sun Mar 21 20:00:32 1999 Install date: Wed Feb 23 13:13:29 2000 Build Host: porky.devel.redhat.com Group : System Environment/Base Source RPM: rootfiles-5.2-5.src.rpm Size : 1912 License: public domain Packager : Red Hat Software http://developer.redhat.com/bugzilla/ Summary : The basic required files for the root user's directory. Description : The rootfiles package contains basic required files that are placed in the root user's account. These files are basically the same as the files found in the etcskel package, which are placed in regular users' home directories.
note the date on that .bashrc file, heh. 13 years ago.
Anne Wilson wrote on Sun, 9 Nov 2008 09:51:16 +0000:
/root/.bashrc
That's exactly what I was looking for, thanks.
That was already told very early on, but you didn't notice it!
Kai
On Monday 10 November 2008 19:31:21 Kai Schaetzl wrote:
Anne Wilson wrote on Sun, 9 Nov 2008 09:51:16 +0000:
/root/.bashrc
That's exactly what I was looking for, thanks.
That was already told very early on, but you didn't notice it!
Looking back, I still can't see it, Kai. I remember being told to look in ~/.bashrc.
Still, the important thing is that I now know where to look.
Anne
On Monday 10 November 2008 19:45:32 Joshua Baker-LePain wrote:
On Mon, 10 Nov 2008 at 7:42pm, Anne Wilson wrote
Looking back, I still can't see it, Kai. I remember being told to look in ~/.bashrc.
If you're root (why are you logging in as root?), then ~ *is* /root.
I wasn't - that's the whole point. That's why I didn't find it.
Anne
On Monday 10 November 2008 19:56:52 Anne Wilson wrote:
On Monday 10 November 2008 19:45:32 Joshua Baker-LePain wrote:
On Mon, 10 Nov 2008 at 7:42pm, Anne Wilson wrote
Looking back, I still can't see it, Kai. I remember being told to look in ~/.bashrc.
If you're root (why are you logging in as root?), then ~ *is* /root.
I wasn't - that's the whole point. That's why I didn't find it.
I guess that the OP thought I was when he said that, though
Anne
On Mon, 2008-11-10 at 20:11 +0000, Anne Wilson wrote:
On Monday 10 November 2008 19:56:52 Anne Wilson wrote:
On Monday 10 November 2008 19:45:32 Joshua Baker-LePain wrote:
On Mon, 10 Nov 2008 at 7:42pm, Anne Wilson wrote
Looking back, I still can't see it, Kai. I remember being told to look in ~/.bashrc.
If you're root (why are you logging in as root?), then ~ *is* /root.
I wasn't - that's the whole point. That's why I didn't find it.
I guess that the OP thought I was when he said that, though
Helped by circumstances. _Normally_, the default install has those aliases only assigned for root, due to the great risk to the system.
So it would be a natural assumption. As usual "assume" has its risks.
Anne
<snip>
On Monday 10 November 2008 20:30:13 William L. Maltby wrote:
Helped by circumstances. _Normally_, the default install has those aliases only assigned for root, due to the great risk to the system.
So it would be a natural assumption. As usual "assume" has its risks.
Well, it might have been painful at the time, dealing with this and with the damage on the box after the kernel bug at the same time, but I've learned a good deal, thanks to the patient answers to my questions. Every cloud has a silver lining :-)
Anne