Not Just Paranoid

Another site by Pete Maynard

Getty: One Less Word

Logging into a Linux machine you might meet a thing called virtual terminals (vtty). Without going to into too much detail, this is a CLI prompt that lets you type commands when you don’t have a GUI running.

Now, back on track. When you login to a machine via the CLI, agetty is used. The provides you with a tty, and a login prompt. You might want to have it auto complete your username, because you’re lazy.

This can be done by editing the agetty@tty1.service, if you’re using systemd, like the below:

/etc/systemd/system/getty.target.wants/getty@tty1.service

[Service]
...
ExecStart=-/sbin/agetty -n -o '<USERNAME>' %I $TERM
...

If you start tty1 (the default one started) you’ll be prompted with only the password.

Now, you’d start your GUI using a command like startx. It will process your $HOME/.xsession file, where you might have the command exec sway. That tells it to start swaywm.

That’s more words to type!

Fear not, you can automate this by adding a few lines to $HOME/.bash_profile:

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then                                         
        startx                                                                                 
fi

If you do all these steps you’ll only have to enter you FDE passphrase, and your user account password, then you’ll be greeted with your nice GUI.

16 Jan 2020

Website Last Updated on 15 Sep 2023 (CC BY-SA 4.0)

This site uses JQuery and nanogallery2 hosted by jsdelivr.net
for the Flickr photo feed and GoatCounter for user insights.