Re: Bad permissions on /tmp
On Wed, 5 Jan 2000, Marco d'Itri wrote:
> On Jan 04, Jules Bean <firstname.lastname@example.org> wrote:
> >Never use /tmp to un-anything files would be one solution.
> Maybe we should put in the default /etc/profile:
> if [ ! -e /tmp/$LOGNAME ]; then
> mkdir /tmp/$LOGNNAME
> export TMPNAME=/tmp/$LOGNAME
I think the right variable to use would be TMPDIR, but I like the idea.
However, I would change it to something like this:
if [ -d "/tmp/$LOGNAME" -a ! -h "/tmp/$LOGNAME" ]
if chmod 700 "/tmp/$LOGNAME" 2> /dev/null
echo "A directory /tmp/$LOGNAME exists, but it appears not to be"
echo "owned by you. Setting TMPDIR to /tmp"
elsif mkdir "/tmp/$LOGNAME" 2> /dev/null && \
chmod 700 "/tmp/$LOGNAME" 2> /dev/null
echo "/tmp/$LOGNAME exists, but it is not a directory or it is"
echo "not owned by you. Setting TMPDIR to /tmp"
This would account for an existing "/tmp/$LOGNAME" that might not be a
directory (-d and ! -h tests) or might not be owned by the user in
question (chmod fails). In those cases, it sets TMPDIR to /tmp. If a
regular file or a symbolic link "/tmp/$LOGNAME" exists, mkdir fails and
TMPDIR is set to /tmp.
On my own system, I use TMPDIR="$HOME/tmp", with $HOME/tmp chmod'ed to
700. I can see why somebody would not like to have TMPDIR on /home, but
the idea of one seperate TMPDIR for each user seems attractive to me.
rd1936: 9:45pm up 2 days, 2:24, 8 users, load average: 2.68, 2.50, 2.28