You are not logged in.

#1 2011-10-30 11:53:16

masterm
Member
Registered: 2011-10-30
Posts: 3

xlsh - eXtended Login Shell

Hello!

I'm new to Arch bbs, though I've been using Arch for quite some time now. So well... hi everyone! smile

Recently I wrote a small program for myself and I feel that more people could benefit from it - so I'm sharing.

xlsh is a simple login shell with readline functionality and PAM integration.

  • When run stand-alone on a virtual console it can replace the standard "login" program.

  • When run in cooperation with X daemon component (xlshd) it can replace XDM/GDM/KDM.

Features:

  • Small and simple, written entirely in C.

  • Easily hackable because of compact codebase (~1000 source lines).

  • Uses PAM for authorization and session management.

  • Ability to select non-default shell/window manager during logon.

  • Entirely keyboard driven display manager replacement (when used with xlshd) without the need for any fat libraries or GUI toolkits.

  • Defaults configured before compilation, some of them can be changed by setting few environment variables.

  • Single shell script file (/etc/xlsh/xlshrc) for customizing how xlshd launches xlsh.

  • Introduces a concept of "pre-login shell" known from GNU/HURD.

  • Only three important commands: 'login', 'reboot' and 'shutdown'.

  • New commands can be easily added (if you need any) by editing xlsh.c

  • Username autocompletion on TAB.

  • Zenburn color scheme by default (when run under X).

So that's it. I grew tired of xdm/gdm/kdm so I rolled out my own solution. I currently run it on all my ttys and as X login manager. Shell-like keyboard only interaction is very comfortable and simple Zenburn colorscheme fits very well into my Awesome WM look & feel (which is also Zenburn).

Let me know if you find it useful. Bug reports, suggestions and any other form of constructive criticism is very much welcome! smile

Offline

#2 2011-10-30 13:12:40

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xlsh - eXtended Login Shell

Bleh, just when I replaced my standard login with SLIM, as I hated the delay between user -> password input that could cause sometimes to enter password before it would be hidden.

Thanks, I'll set this up later smile

Offline

#3 2011-10-30 16:11:15

irtigor
Member
Registered: 2011-01-21
Posts: 44

Re: xlsh - eXtended Login Shell

I liked the idea but, unfortunately, it didn't worked so well here. I got this errors:

INIT: cannot execute "/usr/local/sbin/xlshd" //repeated several times
INIT: Id "X" respawing too fast: disabled for 5 minutes //then a blink cursor appears on the top left of screen (no text/msg)

Notes:
-The /bin/login replacement worked except that I was unable to login in a console (tty1 and tty2) or switch back to X (slim as dm).
-Installed from aur using packer.

---- edit
Replaced /usr/local/sbin/xlsh and /usr/local/sbin/xlshd (pacman -Ql). Fixed.

Last edited by irtigor (2011-10-30 16:42:40)

Offline

#4 2011-10-31 09:54:50

masterm
Member
Registered: 2011-10-30
Posts: 3

Re: xlsh - eXtended Login Shell

irtigor did it install to /usr/local on your system? That's strange it should definitely go to /usr. Did you notice any errors relating to sed while doing makepkg?

sed -i "s:prefix = /usr/local:prefix = /usr:" Makefile

That's the line in PKGBUILD that should have set correct installation prefix.

Offline

#5 2011-10-31 11:28:38

irtigor
Member
Registered: 2011-01-21
Posts: 44

Re: xlsh - eXtended Login Shell

It was installed in /usr/sbin, but I Just C&P from the wiki without verifying... it is working, just need to configure some things (My shell for some odd reason became bash and the dbus+consolekit is not working -- probably not a xlsh fault).

Offline

#6 2011-11-01 01:08:17

Saint0fCloud
Member
Registered: 2009-03-31
Posts: 137

Re: xlsh - eXtended Login Shell

irtigor wrote:

(My shell for some odd reason became bash and the dbus+consolekit is not working -- probably not a xlsh fault).

Awesome piece of software but I'm experiencing a similar problem, zsh gets replaced by regular sh as my default shell but only in urxvt while in xterm everything works the way it's supposed to.

Offline

#7 2011-11-01 13:56:14

masterm
Member
Registered: 2011-10-30
Posts: 3

Re: xlsh - eXtended Login Shell

SHELL environment variable is now properly set under X. Please upgrade. smile

irtigor: I don't think dbus+consolekit is xlsh's fault but just in case can you send me outputs of "env" when you have been logged in by xlsh and by some other login manager like xdm?

EDIT: I also clarified on the wiki that when installing from AUR one should use /usr instead of /usr/local when configuring.

Last edited by masterm (2011-11-01 13:57:30)

Offline

#8 2011-11-05 13:29:24

irtigor
Member
Registered: 2011-01-21
Posts: 44

Re: xlsh - eXtended Login Shell

env (xlsh)

LCLIMPORTDIR=/usr/share/splint/imports
XDG_DATA_HOME=/home/irtigor/.local/share
TERM=rxvt-unicode-256color
SHELL=/bin/zsh
XDG_SESSION_COOKIE=8c19aa75e1df23394088ae2f00001baa-1320498024.774424-1546763611
GTK2_RC_FILES=/home/irtigor/.gtkrc-2.0
LC_NUMERIC=
ANT_HOME=/usr/share/java/apache-ant
USER=irtigor
LARCH_PATH=/usr/share/splint/lib
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_CONFIG_DIRS=/etc/xdg:/etc/xdg
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/share/java/apache-ant/bin:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/irtigor/.rvm/bin
LC_MESSAGES=
HG=/usr/bin/hg
_=/usr/bin/env
LC_COLLATE=
PWD=/home/irtigor
JAVA_HOME=/usr/lib/jvm/java-6-openjdk
LANG=en_US.UTF-8
SHLVL=3
HOME=/home/irtigor
XDG_CONFIG_HOME=/home/irtigor/.config
XDG_CACHE_HOME=/home/irtigor/.cache
LOGNAME=irtigor
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-JT1g91p7nx,guid=9befacf8c90efc2782fc6ccf0000001c
XDG_DATA_DIRS=/usr/share/:/usr/local/share/:/usr/share/:/usr/local/share/
J2SDKDIR=/usr/lib/jvm/java-6-openjdk
LC_CTYPE=en_US.UTF-8
DISPLAY=:0
J2REDIR=/usr/lib/jvm/java-6-openjdk/jre
LC_TIME=
G_BROKEN_FILENAMES=1
WINDOWID=10485770
COLORFGBG=default;default;0
TERMINFO=/usr/share/terminfo
COLORTERM=yes
OLDPWD=/home/irtigor
AUTOJUMP_DATA_DIR=/home/irtigor/.local/share/autojump
EDITOR=vim
PAGER=less
MAIL=/var/mail/irtigor
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
LESS_TERMCAP_mb=[01;31m
LESS_TERMCAP_md=[01;31m
LESS_TERMCAP_me=[0m
LESS_TERMCAP_se=[0m
LESS_TERMCAP_so=[01;44;33m
LESS_TERMCAP_ue=[0m
LESS_TERMCAP_us=[01;32m
BROWSER=firefox
DISABLE_AUTO_UPDATE=true
GREP_OPTIONS=--color=auto
GREP_COLOR=1;32
LSCOLORS=Gxfxcxdxbxegedabagacad

ck-list-sessions (xlsh)

Session1:
	unix-user = '1000'
	realname = '(null)'
	seat = 'Seat2'
	session-type = ''
	active = FALSE
	x11-display = ':0'
	x11-display-device = '/dev/tty3'
	display-device = ''
	remote-host-name = ''
	is-local = FALSE
	on-since = '2011-11-05T12:39:44.074206Z'
	login-session-id = '4294967295'

env (slim)

LCLIMPORTDIR=/usr/share/splint/imports
XDG_DATA_HOME=/home/irtigor/.local/share
SHELL=/bin/zsh
TERM=rxvt-unicode-256color
XDG_SESSION_COOKIE=8c19aa75e1df23394088ae2f00001baa-1320498147.998816-1602302550
GTK2_RC_FILES=/home/irtigor/.gtkrc-2.0
LC_NUMERIC=
ANT_HOME=/usr/share/java/apache-ant
USER=irtigor
LARCH_PATH=/usr/share/splint/lib
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_CONFIG_DIRS=/etc/xdg:/etc/xdg
MAIL=/var/mail/irtigor
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/share/java/apache-ant/bin:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/irtigor/.rvm/bin
LC_MESSAGES=
HG=/usr/bin/hg
_=/usr/bin/env
LC_COLLATE=
PWD=/home/irtigor
JAVA_HOME=/usr/lib/jvm/java-6-openjdk
EDITOR=vim
LANG=en_US.UTF-8
SHLVL=2
HOME=/home/irtigor
XDG_CONFIG_HOME=/home/irtigor/.config
XDG_CACHE_HOME=/home/irtigor/.cache
LOGNAME=irtigor
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Ya5luICcfh,guid=74c155d555aa8c9aa358c87100000014
XDG_DATA_DIRS=/usr/share/:/usr/local/share/:/usr/share/:/usr/local/share/
J2SDKDIR=/usr/lib/jvm/java-6-openjdk
LC_CTYPE=en_US.UTF-8
DISPLAY=:0.0
J2REDIR=/usr/lib/jvm/java-6-openjdk/jre
LC_TIME=
G_BROKEN_FILENAMES=1
XAUTHORITY=/home/irtigor/.Xauthority
WINDOWID=12582922
COLORFGBG=default;default;0
TERMINFO=/usr/share/terminfo
COLORTERM=yes
OLDPWD=/home/irtigor
AUTOJUMP_DATA_DIR=/home/irtigor/.local/share/autojump
PAGER=less
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
LESS_TERMCAP_mb=[01;31m
LESS_TERMCAP_md=[01;31m
LESS_TERMCAP_me=[0m
LESS_TERMCAP_se=[0m
LESS_TERMCAP_so=[01;44;33m
LESS_TERMCAP_ue=[0m
LESS_TERMCAP_us=[01;32m
BROWSER=firefox
DISABLE_AUTO_UPDATE=true
GREP_OPTIONS=--color=auto
GREP_COLOR=1;32
LSCOLORS=Gxfxcxdxbxegedabagacad

ck-list-sessions (slim)

Session2:
	unix-user = '1000'
	realname = '(null)'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0.0'
	x11-display-device = '/dev/tty3'
	display-device = ''
	remote-host-name = ''
	is-local = TRUE
	on-since = '2011-11-05T12:46:37.963456Z'
	login-session-id = '1'
Session1:
	unix-user = '1000'
	realname = '(null)'
	seat = 'Seat2'
	session-type = ''
	active = FALSE
	x11-display = ':0.0'
	x11-display-device = ''
	display-device = ''
	remote-host-name = ''
	is-local = TRUE
	on-since = '2011-11-05T12:46:33.690874Z'
	login-session-id = '1'

Offline

#9 2011-11-06 08:59:59

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: xlsh - eXtended Login Shell

This is pretty nice, I will be using it for my TTY logins, no problems so far.
Thanks for creating this!

Offline

#10 2011-11-09 12:13:25

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: xlsh - eXtended Login Shell

This is really cool, I like it smile

Don't have a lot of time right now, but I just wanted to say 2 quick things:

- First, thank you for creating this. I don't use a DM, but have now switched to xlsh (cause I like having the shutdown/reboot options). Side note: I new to Ach, or Linux in fact, and I really love how pretty much every single bit of the system can be replaced by something else if you don't like it. Or, if you can, just make your own! smile It's just really cool. (Also, alongside Linux I decided I'd try and learn some C as well, so I'm liking this even more.)

- Second, I realized that when using xlsh my Ctrl+C doesn't actually always work anymore. That is, when I want to use it to "break" it doesn't, but in app where it's assigned to something else (e.g. copy to clipboard) it still works. So it's mostly seen from console/terminal.
From what I understand, this is because xlsh blocks SIGINT, so I did this little patch that restores signals before starting the shell. Seems to have fixed the issue as far as I can tell:

diff -upr org/include/libxlsh.h patched/include/libxlsh.h
--- org/include/libxlsh.h	2011-11-01 14:48:33.000000000 +0100
+++ patched/include/libxlsh.h	2011-11-09 12:51:32.027322913 +0100
@@ -24,6 +24,7 @@
 
 size_t libxlsh_strnlen(const char* s, size_t maxlen);
 void   libxlsh_proc_sigmask(void);
+void   libxlsh_restore_sigmask(void);
 pid_t  libxlsh_proc_exec(const char* cmdline, int flags);
 pid_t  libxlsh_pid_read(const char* filename);
 int    libxlsh_pid_lock(const char* filename, pid_t pid, int flags);
diff -upr org/src/libxlsh.c patched/src/libxlsh.c
--- org/src/libxlsh.c	2011-11-01 14:48:33.000000000 +0100
+++ patched/src/libxlsh.c	2011-11-09 12:51:46.343989843 +0100
@@ -32,6 +32,11 @@ void libxlsh_proc_sigmask(void)
   sigprocmask(0, NULL, &xlsh_default_sigmask);
 }
 
+void libxlsh_restore_sigmask(void)
+{
+  sigprocmask(SIG_SETMASK, &xlsh_default_sigmask, NULL);
+}
+
 pid_t libxlsh_proc_exec(const char* cmdline, int flags)
 {
   pid_t pid;
diff -upr org/src/xlsh.c patched/src/xlsh.c
--- org/src/xlsh.c	2011-11-01 14:48:33.000000000 +0100
+++ patched/src/xlsh.c	2011-11-09 12:51:16.347323106 +0100
@@ -330,6 +330,7 @@ int xlsh_session_exec(pam_handle_t* hand
     if(*terminal)
       setenv("TERM", terminal, 1);
 
+    libxlsh_restore_sigmask();
     execlp(session, _arg0, (char*)0);
     exit(EXIT_FAILURE);
   }

Thanks again for creating/sharing this!
-jacky

Offline

Board footer

Powered by FluxBB