Showing posts with label configuration. Show all posts
Showing posts with label configuration. Show all posts

Tuesday, October 16, 2012

Setting Up XDM on Debian/Ubuntu Linux

XDM, short for X Display Manager, is my favorite login manager for its simplicity. Sure, gdm and kdm are visually pleasant, but why do I have to install all the dependencies if xdm provides the same functionality as them? After all, xdm can launch GNOME and KDE for you — you just need to fix your ~/.xsession file. This post will serve as my notes on installation, configuration and customization of xdm.



All configuration of xdm, except for distribution-specific settings, is done by modifying the files in the /etc/X11/xdm directory. For now, I'll just go over what I have in my xdm files.



/etc/X11/xdm/Xaccess



This file is used to tell xdm who can use xdm. Therefore, if you are happy to let anyone access the X-Windows desktop locally or remotely, then you would just put an asterisk (*) in Xaccess as I did.



*


If you are very keen on security, you would put only the following in Xaccess. This only allows local users to have access to xdm.



localhost
127.0.0.1


However, even if Xaccess is set up as above, remote xdm login may still be possible with SSH X11 forwarding.



/etc/X11/xdm/Xresources



Xresources file is used to fine-tune the behavior and appearance of XDM. Here is what I put in my Xresources file:



Xcursor.theme: redglass

xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
<Key>Home: move-to-begining()\n\
<Key>End: move-to-end()\n\
Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()\n\
<Key>KP_Enter: set-session-argument() finish-field()\n\
Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\
<Key>Return: set-session-argument() finish-field()

xlogin*greeting: Welcome to CLIENTHOST
xlogin*namePrompt: Login:\040
xlogin*passwdPrompt: Password:\040
xlogin*fail: Login incorrect

xlogin*greetFace: Serif-21:bold:italic
xlogin*face: Sans-15
xlogin*promptFace: Sans-15:bold
xlogin*failFace: Sans-16:bold

xlogin*geometry: 600x400
xlogin*borderWidth: 1
xlogin*frameWidth: 5
xlogin*innerFramesWidth: 2
xlogin*shdColor: grey30
xlogin*hiColor: grey90
xlogin*background: grey
xlogin*greetColor: Blue3
xlogin*failColor: red
*Foreground: black
*Background: #fffff0

xlogin*logoFileName: /usr/share/X11/xdm/pixmaps/penguin_doll_200x300.xpm
xlogin*useShape: true
xlogin*logoPadding: 10


I think the settings are self-explanatory. This is how xdm would look with the above settings. The penguin image was taken from here.



xdm-screenshot

/etc/X11/xdm/Xresources



The Xresources file allows you to specify how many X servers to run and their command arguments. In my case, I run Xorg and Xvfb. Xorg is the standard X server, and Xvfb is a server that runs totally in memory without depending on the video hardware. To see what's going on with Xvfb, I use x11vnc and gvncviewer.



# Default X.org server
:0 local /usr/bin/Xorg :0 vt7 -br -dpi 96 -nolisten TCP

:1 local /usr/local/bin/Xvfb :1 -dpi 96 -screen 0 1024x768x16


/etc/X11/xdm/Xsetup



Xsetup allows you to write any command to run when xdm displays the login screen. In my case, I run gm to set up the background image and run x11vnc to remotely access Xvfb via VNC.



#!/bin/sh
#
# This script is run as root before showing login widget.

gm display -window root /usr/share/wallpapers/Board_Tile_Gray.jpg
xkbcomp -dflts -I/usr/share/X11/xkb /etc/X11/xkb/server-0.xkm $DISPLAY

PID_XVFB=$(pidof Xvfb)
PID_X11VNC=$(pidof x11vnc)
if [ -n "$PID_XVFB" -a -z "$PID_X11VNC" ]; then
x11vnc -display :1 -bg -xkb -nopw -nc_cr -forever -listen localhost -auth $(find /var/lib/xdm/authdir/authfiles -name \*:1\*) > /var/log/x11vnc.log 2>&1
fi


/etc/X11/xdm/xdm-config



In xdm-config, there is only one line that I bother to change. This line enables remote xdm logins.



! SECURITY: do not listen for XDMCP or Chooser requests
! Comment out this line if you want to manage X terminals with xdm
DisplayManager.requestPort: 177


/etc/X11/xdm/xdm-options



I think xdm-options is Debian specific. I don't think I made any change in this file.



# configuration options for xdm
# See xdm.options(5) for an explanation of the available options.

no-ignore-nologin
no-restart-on-upgrade
no-start-on-install
use-sessreg


Resetting XDM



There are other files in /etc/X11/xdm directory that you can safely leave as is. After you make any change with the files, have xdm reread the config files.



kill -1 $(pidof xdm)


If you want to force xdm to kill all running sessions and restart, enter the following command.



/etc/init.d/xdm restart


That's all I have to write about xdm for now. In summary, xdm is a simple, yet functional login manager that is easy to set up.

Tuesday, July 14, 2009

My .profile for MinGW and Cygwin

The file .profile is a personal initialization file used both by MinGW and Cygwin Bash shell. It has many uses depending on how one uses it. I edit it primarily to customize my own build environment. .profile should be placed in the %HOME% directory. If %HOME% is not set, it is searched for in, for example, C:\MSYS\1.0\home\Aziz.

Because the name .profile begins with a dot, Windows explorer may not allow you to create it. If so, type the following command in Command Prompt (cmd.exe) to create .profile.


copy nul .profile

In a MSYS or Cygwin shell, type the following command to create .profile.


touch .profile


.profile For MinGW


The following is the contents of my .profile for MinGW:


CC='/mingw/bin/gcc.exe'
CFLAGS='-march=pentium2 -mtune=i586 -mthreads -O2 -g0 -mms-bitfields'
CPPFLAGS='-DWIN32 -D_WIN32 -D__WINDOWS__ -DMINGW32 -D__MINGW32__'
CXXFLAGS="${CFLAGS}"
LDFLAGS='-Wl,--enable-auto-image-base -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc '
PKG_CONFIG_PATH="C:\MinGW\lib\pkgconfig"
export CC CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH

After you make any change to .profile, be sure to restart the MSYS terminal. Otherwise, do this:


source ~/.profile


.profile for Cygwin


The following is the contents of my .profile for Cygwin:


CC='/usr/bin/gcc-3.exe '
CFLAGS='-march=pentium2 -mtune=i586 -O2 -g0'
CXXFLAGS="${CFLAGS}"
LDFLAGS='-Wl,--enable-auto-image-base -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc '
export CC CFLAGS CXXFLAGS LDFLAGS

After you make any change to .profile, be sure to restart the Cygwin Bash shell. Otherwise, do this:


source ~/.profile


.profile for Cygwin-to-Win32 Cross-Compiler


Cygwin can be used to compile native Windows binaries that don't depend on cygwin1.dll. The following .profile contents enable such compiler environment:


CC='/usr/bin/gcc-3.exe '
CFLAGS='-mno-cygwin -march=pentium2 -mtune=i586 -O2 -fomit-frame-pointer -pipe '
CPPFLAGS='-mno-cygwin -DMINGW32 '
CXXFLAGS="${CFLAGS}"
LDFLAGS='-mno-cygwin -Wl,--enable-auto-image-base -Wl,--enable-auto-import -Wl,-
-enable-runtime-pseudo-reloc '
export CC CFLAGS CPPFLAGS CXXFLAGS LDFLAGS

When you compile programs, make sure to specify --build=i586-pc-mingw32 --prefix=/usr/i686-pc-mingw32 on the configure line.


./configure --build=i586-pc-mingw32 --prefix=/usr/i686-pc-mingw32
make
make install


Choices for -march and -mtune Options


The -march and -mtune options in the CFLAGS environment variable determine how GCC will compile optimized/generic codes for certain CPU families. I've tried several combinations for these options, as follows:


  • -march=pentium2 -mtune=i586
  • -march=pentium3 -mtune=i586
  • -march=k6-2 -mtune=pentium-mmx
  • -march=k8 -mtune=pentium-mmx

I haven't tested these choices extensively, but I believe the following will produce fairly generic code:


-march=pentium2 -mtune=i586

For more information on available -march and -mtune options, read this: i386 and x86-64 Options - Using the GNU Compiler Collection (GCC).

Thursday, April 2, 2009

Tweaking Windows Vista for Slow PC

Is Windows Vista only for fast and powerful computers? Not really. Technically, Vista can run on old computers with a CPU as slow as 800MHz. But Vista runs sluggish on old computers. For those old and slow computers, there are some ways to improve the speed of Vista, as explained below.


Stop unnecessary programs from running or starting.


Don't use the Windows Sidebar. This program is unnecessary and graphics-intensive program that slows your computer down. You can easily disable it from starting.


Disable UAC


Disabling UAC may dramatically speed up Windows Vista.



Disable Windows Theme


If you don't need fancy Windows themes, you can change your theme to a plain one or disable the Themes service altogether.

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger