Bug 994722 - Using SSH to remotely monitor a box creates a lot of /tmp/.colorlsXXX
Using SSH to remotely monitor a box creates a lot of /tmp/.colorlsXXX
Status: CLOSED DUPLICATE of bug 988152
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ondrej Oprala
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-08-07 16:59 EDT by Scott Baker
Modified: 2013-08-14 08:34 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-14 08:34:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Scott Baker 2013-08-07 16:59:11 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.
Comment 1 Ondrej Vasik 2013-08-08 02:52:13 EDT
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.
Comment 2 Ondrej Oprala 2013-08-08 04:54:02 EDT
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?
Comment 3 Scott Baker 2013-08-08 11:51:52 EDT
: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.
Comment 4 Scott Baker 2013-08-08 11:53:27 EDT
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.
Comment 5 Scott Baker 2013-08-08 12:31:59 EDT
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.
Comment 6 Scott Baker 2013-08-08 12:38:19 EDT
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 user@server.com "cat ~/.bash_history"

You should see a /tmp/.colorsXXX file created for each time you login.
Comment 7 Ondrej Oprala 2013-08-14 08:34:04 EDT
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 ***

Note You need to log in before you can comment on or make changes to this bug.