Beautify Your /bin/login

05/22/2020

I'd been looking for a bit to stop using a display manager for my main, single user computer, since there isn't a lot of use for a complicated login manager when all I'm going to do is type in my password. This means that I would need to have X (or my desktop environment of choice) start automatically when I log into tty1. You can put this check in your ~/.bash_profile with a good example on the Gentoo wiki. The only issue I had migrating from lightdm was that there were a couple environment variables not set properly at first when starting X in this fashion, but it was easy to find out what with set or env.

Since /etc/inittab is going to be the file your init will read off after "starting" (this is what calls agetty), you can tweak it to personalize its behavior. The cool bit is the ability to login in style by telling /etc/inittab to run your own login wrapper script. You can do this by passing the program to agetty like this, and now you suddenly have free reign to run some nice programs as you log in. Since agetty opens a tty port and then simply invokes /bin/login, passing an alternative program to it with --login-program works as long as you remember to run /bin/login. Pretty cool, right? Right now I just do a funny cowsay before my password prompt, for that authentic hacker aesthetic. I really recommend this method for single user systems, since it allows you a lot of freedom of what you can do with your login. Just make sure you're either invoking your desktop environment directly in your ~/.bash_profile hack, or if you're using a window manager, invoking your startup programs in your ~/.xinitrc.


home | blog index | rss | contact me | PGP public key?