Disappearing files, created from /etc/X11/Xclients

Laszlo Nagy gandalf at designaproduct.biz
Tue Mar 20 13:53:00 UTC 2007


  Hi,

I'm running several diskless boxes. They connect to the same server with 
xdmpc (gdm). When a user logs in, the WM is started by script 
/etc/X11/Xclients:

#!/bin/sh
xmodmap /etc/X11/xmodmap.hun
exec /etc/X11/startwm.py

You can find the startwm.py script at the end of this e-mail. Most 
importantly, I wanted to save client IP addresses and the date of the 
login into different files. These files are located under 
/tmp/disklessips/*. Rights for /tmp/diskless is octal 42777:

drwxrwsrwx  2 root     users         512 Mar 20 14:41 disklessips

The strange thing is that, if I login with user 'gandalf' who is in 
'wheel', the files are created and saved into 
/tmp/disklessips/gandalf.txt and /tmp/disklessips/gandalf.history.txt. 
But if I login with any other user (they are in group 'users'), no files 
are created, but the window manager IS started. The startwm.py program 
creates these files BEFORE starting gnome, and it does throw an error. 
So they must have been created, but I do not see them anywhere. They 
simply disappear. Never existed? Any thoughts?

Thanks,

   Laszlo



#!/usr/local/bin/python
import os
import datetime

WM = """exec dbus-launch --exit-with-session gnome-session"""

# Extract client IP
display = os.environ['DISPLAY']
idx = display.find(':')
remotehost = display[:idx]
os.environ['REMOTEHOST'] = remotehost

# Save client IP
ddir = '/tmp/disklessips'
fout = file('%s/%s.txt'%(ddir,os.getlogin()),'wb+')
fout.write(remotehost)
fout.close()
# Save history
fout = file('%s/%s.history.txt'%(ddir,os.getlogin()),'ab+')
fout.write( datetime.datetime.now().isoformat()[:19] + '\t' + remotehost 
+ '\n' )
fout.close()

os.system(WM)



More information about the freebsd-questions mailing list