the xserverrc file is a shell script responsible for starting up the x server
both startx and xinit execute ~/.xserverrc if it exists, startx will use /etc/X11/xinit/xserverrc otherwise
in order to maintain an authenticated session with logind and to prevent bypassing the screen locker by switching terminals, xorg has to be started on the same virtual terminal where the login occurred, therefore it is recommended to specify vt$XDG_VTNR in the ~/.xserverrc file
sudo nano ~/.xserverrc
(add these lines)
#!/bin/sh
exec /usr/bin/Xorg -nolisten tcp "$@" vt$XDG_VTNR
(save and exit --> Ctrl-O, enter, Ctrl-X, enter)
to apply the same patch system-wide, add the above lines to /etc/X11/xinit/xserverrc file