/tmp is unwriteable

Nitebirdz nitebirdz at sacredchaos.com
Fri Feb 24 21:33:17 UTC 2006


On Fri, Feb 24, 2006 at 03:50:23PM -0400, Derek Broughton wrote:
> 
> Where is /tmp initialized?  
> -- 

[nitebirdz at frankfurt:]$ grep "/tmp" /etc/init.d/* | more
/etc/init.d/bootclean.sh:# bootclean.sh Functions to clean /tmp,
/var/run and /var/lock.
/etc/init.d/bootclean.sh:       [ -f /tmp/.clean ] && return
/etc/init.d/bootclean.sh:       # Don't clean /tmp if TMPTIME < 0 or
"infinite"./etc/init.d/bootclean.sh:       #       Wipe /tmp, but
exclude system files.
/etc/init.d/bootclean.sh:       [ "$VERBOSE" != no ] && log_begin_msg
"Cleaning
/tmp..."
/etc/init.d/bootclean.sh:       rm -f /tmp/.clean
/etc/init.d/bootclean.sh:       :> /tmp/.clean
/etc/init.d/bootclean.sh:       #       Only clean out /tmp if it is
world-writable. This ensures
/etc/init.d/bootclean.sh:       ( if cd /tmp && [ "`find . -maxdepth 0
-perm -002`" = "." ]
/etc/init.d/bootclean.sh:       rm -rf /tmp/.clean
/etc/init.d/bootclean.sh:       :> /tmp/.clean
/etc/init.d/bootclean.sh:       if [ -f /tmp/.clean ] && [ -f
/var/run/.clean ]
&&
/etc/init.d/bootclean.sh:       [ -d /tmp ] && cleantmp
/etc/init.d/bootmisc.sh:rm -f /tmp/.clean /var/run/.clean
/var/lock/.clean
/etc/init.d/mountall.sh:#       Clean /tmp, /var/lock, /var/run
/etc/init.d/mountnfs.sh:#       Clean /tmp, /var/lock, /var/run
/etc/init.d/mountvirtfs:if [ -f /etc/default/tmpfs ]
/etc/init.d/mountvirtfs:        . /etc/default/tmpfs
/etc/init.d/mountvirtfs:# max size using /etc/default/tmpfs to prevent
tmpfs from using
/etc/init.d/umountnfs.sh:rm -f /tmp/.clean /var/lock/.clean
/var/run/.clean
/etc/init.d/xorg-common:SOCKET_DIR=/tmp/.X11-unix
/etc/init.d/xorg-common:ICE_DIR=/tmp/.ICE-unix


>From "/etc/init.d/bootclean.sh":

     10 cleantmp() {
     11
     12   [ -f /tmp/.clean ] && return
     13
     14   # Don't clean /tmp if TMPTIME < 0 or "infinite".
     15   case "$TMPTIME" in
     16     -*|infinite)
     17       return
     18       ;;
     19   esac


My guess is that "/tmp" gets initialized/mounted by the init script in 
"/etc/init.d/mountall.sh":

     13 #
     14 # Mount local file systems in /etc/fstab.
     15 #
     16 log_begin_msg "Mounting local filesystems..."
     17 (
     18     if mount -av -t
nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noo        cfs2,nogfs;
then
     19         log_end_msg 0
     20     else
     21         log_end_msg 1
     22     fi
     23 ) 2>&1 | egrep -v '(already|nothing was) mounted'
     24
     25 case `uname -s` in
     26   *FreeBSD)
     27     INITCTL=/etc/.initctl
     28     ;;
     29   *)
     30     INITCTL=/dev/initctl
     31     ;;
     32 esac


----------------
Nitebirdz
http://www.sacredchaos.com/




More information about the ubuntu-users mailing list