Penguin
Diff: PerUserTempDirs
EditPageHistoryDiffInfoLikePages

Differences between version 5 and predecessor to the previous major change of PerUserTempDirs.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 5 Last edited on Tuesday, November 16, 2004 10:48:01 am by PerryLorier Revert
Older page: version 1 Last edited on Tuesday, November 16, 2004 10:20:12 am by PerryLorier Revert
@@ -1,10 +1,14 @@
-This trick is for multiuser boxes to try and ammeleriate issues with people creating insecure temporary files (and to make it obvious which applications don't respect TMPDIR). The idea is to create a seperate directory for every user on the machine that's 700 to that user and point TMPDIR at it. I think that this idea could(/should?) be used by default by distributions. 
+This trick is for multiuser boxes to try and ammeleriate issues with people creating insecure temporary files (and to make it obvious which applications don't respect TMPDIR). The idea is to create a seperate directory for every user on the machine that's 700 to that user and point TMPDIR at it. I think that this idea could(/should?) be used by default by distributions. This can be extended to work for other services (eg apache)
  
-The first part of the script goes in .bash_profile: 
+Points for:  
+* It pretects 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
  # Set up each users own temp directory (kinda) 
  mkdir /tmp/$USER 2>/dev/null 
- if [ -O /tmp/$USER ]; then 
+ if [ [ -O /tmp/$USER ]; then 
  TMPDIR=/tmp/$USER 
  else 
  TMPDIR=$(mktemp -d /tmp/${USER}.XXXXXX) 
  fi 
@@ -22,4 +26,11 @@
  
 This means that it will remove the directory when the last shell is closed and there are no more files in the directory. 
  
 If users want scratch space to copy files between users etc, they can use /tmp directly as [LFS] suggests, however conformant programs should use /tmp/''username'' or /tmp/''username''.''uniqueid''. 
+  
+Alternatively the first script can be placed in /etc/profile.d/ and the .bash_logout script can be ignored and the directories can be removed regularly from cron if necessary.  
+  
+Ideally Linux could transparently produce a unique /tmp/ for each $USER on the system, but that would break LinuxStandardsBase compiliance and many applications.  
+  
+----  
+CategorySecurity