[plug] telnet server question

Craig Ringer craig at postnewspapers.com.au
Thu Jul 24 08:41:15 WST 2003


> Good idea! Perhaps it would be pretty easy? For example, people can in
> general run shells or graphic dialogues to enter SSH passphrases (after
> logging in but before the desktop loads). If you run a dead-end
> programme (which does some string matching, then displays and alert and
> an 'OK' button, and perhaps has a timeout) instead, they would get the
> message and then be logged out. Maybe this would merely require a line
> to be inserted into an Xblah file somewhere?

Well, you wanted to take that approach, you could use something like

#!/bin/bash
if [ -z "$DISPLAY" ] ; then
	# Normal console login
	echo "This account is disabled. Exiting."
	# how do you wait for a keypress, anyway? Do it here.
else
	# We have an X11 display, so use gmessage/xmessage
	if [ -x `which gmessage` ] ; then
		MSG_CMD=gmessage
	elif [ -x `which xmessage` ] ; then
		MSG_CMD=xmessage
	else
		# do something clever with an xterm, probably.
		# I can't be stuffed, though.
		echo "Urrggh. No [gx]message found."
		MSG_CMD=echo
	fi
	$MSG_CMD "This account is disabled. Your session will exit when you 
click OK."
fi


(note: written in the message, and I'm lousy at shell scripting. Don't 
expect it to work.)

That said, I'd prefer a solution integrated into the login manager, so 
that rather than starting a login session, if the user correctly 
authenticates but has an invalid shell it displays a message. Much 
cleaner than having the session appear to start, only to pop up a 
message - and I'm also much happier not having the user's X session 
begin AT ALL, just in case.

I'm actually tempted to have a look at the GDM code and see how hard it 
would be. I'm an apalling C coder too, but all I'd be interested in 
doing would be finding out if I could make it work in a test environment.

Craig Ringer




More information about the plug mailing list