I am on WSL 2 running Ubuntu.When I open terminal, it directly logs me in without asking credentials.This is the only single terminal that is open, why do I see different output:
output from tty:
mshah@NL-1023517:~$ tty/dev/pts/0
output from who:
mshah@NL-1023517:~$ whomshah pts/1 2025-04-21 18:19
If 0,1,2 are link to descriptor for stdin, stdout & stderr respectively in pseudo-terminals, why do I see only 0 & 1 in
ls -l /dev/pts
mshah@NL-1023517:~$ ls -l /dev/ptstotal 0drwxr-xr-x 2 root root 0 Apr 21 18:19 ./drwxr-xr-x 16 root root 3580 Apr 21 18:19 ../crw--w---- 1 mshah tty 136, 0 Apr 24 05:17 0crw------- 1 mshah tty 136, 1 Apr 21 18:19 1c--------- 1 root root 5, 2 Apr 21 18:19 ptmx
Also, output of pf -ef shows:
mshah@NL-1023517:~$ ps -efUID PID PPID C STIME TTY TIME CMDroot 1 0 0 Apr22 ? 00:07:56 /sbin/initroot 2 1 0 Apr22 ? 00:00:03 /initroot 6 2 0 Apr22 ? 00:00:00 plan9 --control-socket 7 --log-level 4 --server-fd 8 --pipe-fd 10 --log-truncateroot 41 1 0 Apr22 ? 00:00:02 /lib/systemd/systemd-journaldroot 60 1 0 Apr22 ? 00:00:02 /lib/systemd/systemd-udevdroot 64 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/bare_5.snap /snap/bare/5 -o ro,nodev,allow_other,suidroot 73 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/core22_1380.snap /snap/core22/1380 -o ro,nodev,allow_other,suidroot 76 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/core22_864.snap /snap/core22/864 -o ro,nodev,allow_other,suidroot 88 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/gtk-common-themes_1535.snap /snap/gtk-common-themes/1535 -o ro,nodev,allow_other,suidroot 89 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/snapd_21759.snap /snap/snapd/21759 -o ro,nodev,allow_other,suidroot 90 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/snapd_20290.snap /snap/snapd/20290 -o ro,nodev,allow_other,suidroot 100 1 0 Apr22 ? 00:00:00 snapfuse /var/lib/snapd/snaps/ubuntu-desktop-installer_1276.snap /snap/ubuntu-desktop-installer/1276 -o ro,nodev,allow_other,suidroot 107 1 0 Apr22 ? 00:00:01 snapfuse /var/lib/snapd/snaps/ubuntu-desktop-installer_1286.snap /snap/ubuntu-desktop-installer/1286 -o ro,nodev,allow_other,suidsystemd+ 195 1 0 Apr22 ? 00:00:01 /lib/systemd/systemd-resolvedroot 203 1 0 Apr22 ? 00:00:00 /usr/sbin/cron -f -Pmessage+ 205 1 0 Apr22 ? 00:00:00 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-onlyroot 208 1 0 Apr22 ? 00:00:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggerssyslog 209 1 0 Apr22 ? 00:00:00 /usr/sbin/rsyslogd -n -iNONEroot 211 1 0 Apr22 ? 00:00:07 /usr/lib/snapd/snapdroot 224 1 0 Apr22 ? 00:00:00 /lib/systemd/systemd-logindroot 258 1 0 Apr22 ? 00:00:00 /bin/bash /snap/ubuntu-desktop-installer/1286/bin/subiquity-serverroot 290 1 0 Apr22 hvc0 00:00:00 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 vt220root 301 1 0 Apr22 tty1 00:00:00 /sbin/agetty -o -p -- \u --noclear tty1 linuxroot 303 1 0 Apr22 ? 00:00:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signalroot 305 258 0 Apr22 ? 00:00:23 /snap/ubuntu-desktop-installer/1286/usr/bin/python3.10 -m subiquity.cmd.server --use-os-prober --storage-version=2 --postinst-hooks-dir=/snap/ubuntu-desktop-installer/1286/etc/subiquity/postinst.droot 341 2 0 Apr22 pts/1 00:00:00 /bin/login -fmshah 403 1 0 Apr22 ? 00:00:00 /lib/systemd/systemd --usermshah 404 403 0 Apr22 ? 00:00:00 (sd-pam)mshah 415 341 0 Apr22 pts/1 00:00:00 -bashroot 438 305 0 Apr22 ? 00:03:18 python3 /snap/ubuntu-desktop-installer/1286/usr/bin/cloud-init status --waitroot 56485 1 0 Apr23 ? 00:00:00 /usr/libexec/packagekitdroot 56489 1 0 Apr23 ? 00:00:00 /usr/libexec/polkitd --no-debugroot 201661 2 0 05:16 ? 00:00:00 /initroot 201662 201661 0 05:16 ? 00:00:00 /initmshah 201663 201662 0 05:16 pts/0 00:00:00 -bashmshah 201706 201663 0 05:17 pts/0 00:00:00 ps -efmshah@NL-1023517:~$
Q) With only one /dev/pts/0, why does it show that I am logged in from /dev/pts/1
Q) In processes (ps -ef) why are two bash processes running under my ID when I have only one terminal open?
I read this& this, but it is still not clear and if someone can help simply bit more, really appreciate it.