Red Hat Bugzilla – Bug 994722
Using SSH to remotely monitor a box creates a lot of /tmp/.colorlsXXX
Last modified: 2013-08-14 08:34:04 EDT
I use Nagios + SSH to login and monitor my servers. I noticed on my Fedora 19 server that the /tmp directory has a TON (over 9000) /tmp/.colorlsXXX files.
I removed all of them, and now they're slowing being recreated. Looking at them, they're all associated with an SSH login. Everytime Nagios logs in to check something a new .colorlsXXX file is created.
I'm not sure what creates those files, and why they're not being removed when the SSH session closes.
These files were introduced with the "include" support, see http://pkgs.fedoraproject.org/cgit/coreutils.git/tree/coreutils-colorls.sh script for details - /etc/profile.d/colorls.sh script creates them - but should clear them immediately automatially. What version of coreutils package do you have?
Anyway, moving this bugzilla to Ondrej Oprala, so he may analyze and adjust the feature implementation to address this. Note that there were already some fixes in this part, so coreutils version may be the difference here.
Thanks for reporting this. Could you please provide some more information? Which shell do you use on the server side? And what coreutils version do you have?
:rpm -q coreutils
I cleared out all the files yesterday, and when I checked it today I see over 6000!
:ls /tmp/.colorls* -1 | wc
6176 6176 104992
We do monitor this box at least once a minute (if not more) via SSH. I did disable the tmpfs mount of /tmp per:
Not sure if that has anything to do with it.
I forgot to mention that my nagios user has /bin/bash as the prompt. It *should* be a pretty generic user. I created it, setup an SSH key, and put a script in its homedir to monitor the box.
I believe I found the bug. I had a script in /etc/profile.d/ that was changing my prompt $PS1. It was setting $PS1 even for non-interactive shells, which triggered the lscolors mktemp. I'm not sure why it would create it, but NOT delete it though.
You can recreate this bug by setting PS1 in /etc/profile.d like this:
echo 'PS1=testing ; export PS1' > /etc/profile.d/test.sh ; chmod +x /etc/profile.d/test.sh
Then ssh in non-interactively
ssh email@example.com "cat ~/.bash_history"
You should see a /tmp/.colorsXXX file created for each time you login.
Thanks for the info. It seems this is a duplicate of another bug though, so I will post any additional info there.
*** This bug has been marked as a duplicate of bug 988152 ***