Disappearing files, created from /etc/X11/Xclients




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)

_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Is it possible to find out if mstsc.exe was able to login or not?
    ... mind is to check the output from a "netstat -an" command on the ... client, and search for an established connection to port 3389 on ... I've been asked to write a script of some sort which will find ... out whether the login failed ...
    (microsoft.public.windows.terminal_services)
  • RE: Print Management Default Printer
    ... What operating systems are you using on the client and the server? ... I currently make all my users set a ... default printer everytime they login because it wipes out the default...... ... I suppose I could set the script for every user but this seems extremely ...
    (microsoft.public.windows.terminal_services)
  • Re: How to block SOME remote users while allowing others?
    ... script and also create a connection and disconnection logon ... But that will limit them also when connecting from the inside. ... The login is from that terminal only, ... OK, if it's only a single client or user you want to block, then ...
    (microsoft.public.windows.terminal_services)
  • Re: File copied to desktop in login script appears to be overwritten by users profile
    ... I say "appears" because if I put a pause in the script, ... However, if I check the client desktop, it is still the old ... What I think is happening is, the login script is successfully copying ...
    (microsoft.public.windows.server.sbs)
  • Re: Install printers to groups of users or computers by using Group Policy
    ... In the SBS 2003 environment, the client printer is installed by the SBS ... The script do not depend on group policy, ...
    (microsoft.public.windows.server.sbs)