Differences between current version and previous revision of PerUserTempDirs.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 13 | Last edited on Wednesday, February 7, 2007 10:29:21 pm | by DanielLawson | |
Older page: | version 12 | Last edited on Wednesday, February 7, 2007 10:22:02 pm | by DanielLawson | Revert |
@@ -4,25 +4,25 @@
* It helps to protect against abusers with exploited non-root services from leveraging a tmpfile exploit to gain a users account.
* It reduces the effects of /tmp becoming large and therefore slow to search.
The first part of the script goes in /etc/skel/.bash_profile before you create user accounts:
-<pre
>
+<verbatim
>
# Set up each users own temp directory (kinda)
mkdir -p /tmp/$USER/create.$$ 2>/dev/null
- if [
[ -O /tmp/$USER ]; then
+ if [ -O /tmp/$USER ]; then
TMPDIR=/tmp/$USER
else
TMPDIR=$(mktemp -d /tmp/${USER}.XXXXXX)
fi
touch $TMPDIR/.bash.$$
- [
[ -d $TMPDIR/create.$$ ] && rmdir $TMPDIR/create.$$
+ [ -d $TMPDIR/create.$$ ] && rmdir $TMPDIR/create.$$
TMP=$TMPDIR
TEMP=$TMPDIR
export TMPDIR TMP TEMP
-</pre
>
+</verbatim
>
Then in .bash_logout:
<pre>
rm $TMPDIR/.bash.$$