From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 22:57:17 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F11041065679 for ; Fri, 9 Oct 2009 22:57:17 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id B221D8FC13 for ; Fri, 9 Oct 2009 22:57:17 +0000 (UTC) Received: from r55.edvax.de (port-92-195-71-245.dynamic.qsc.de [92.195.71.245]) by mx01.qsc.de (Postfix) with ESMTP id C57FA3D049 for ; Sat, 10 Oct 2009 00:57:14 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n99MvEQd002321 for ; Sat, 10 Oct 2009 00:57:14 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sat, 10 Oct 2009 00:57:14 +0200 From: Polytropon To: FreeBSD Questions Message-Id: <20091010005714.cd7b118d.freebsd@edvax.de> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Automated login, X and xdm X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 22:57:18 -0000 Dear list, in order to do something that I haven't done for many years, I'd like to have some suggestions or pointers if I do it right. It's a strange, but still typical idea. :-) Here's the problem: A FreeBSD workstation should run X for a specified user after system startup. If the user logs out, he should not drop to CLI mode; instead, an xdm login should be shown to allow him (or someone else) to log in and use X. In the past, I created the auto-login as follows: First, I create an entry in /etc/gettytab, right after the "default:" entry; it contains the al= definition for auto-login as explained in "man 5 gettytab". The name of the user is USER in this example; in fact, is is a valid username on the system: autologin:\ :al=USER:tc=Pc: Then I change the getty argument from "Pc" to "autologin" in /etc/ttys: ttyv0 "/usr/libexec/getty autologin" cons25l1 on secure This automatically logs in the user USER specified as above. In order to start X when he logs in, I put the following lines in his ~/.login: #!/bin/sh mesg y [ ! -f /tmp/.X0-lock ] && startx The user's shell is the C-Shell, so it works. I see the upcoming problem: If a user already started X, then xdm cannot start (as usually done by setting "on" for xdm in /etc/ttys). My idea would be to do something like this into the user's ~/.login file: #!/bin/sh mesg y # very first start of X at (automatic) login # this line will fail if X is already running, but # start it if not [ ! -f /tmp/.X0-lock ] && startx # after leaving X, xdm should be started, but not if # it's already running [ ! -f /tmp/.X0-lock ] && sudo xdm # after xdm is started, dialog mode is back, so the # last entry quits any session after exiting from X logout Normally, there would be the following setting to only run xdm, without autologin, in /etc/ttys: ttyv8 "/usr/local/bin/xdm -nodaemon" xterm on secure But this interferes with the autologin, right? What is the usual way to go? Is there something more elegant? How about "exec startx"? Thanks for your ideas and time! -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...