When using a terminal session via ssh to a FreeBSD 12 server, how can I verify the name of the user in that session?
Two easy ways are with the
who command. They will tell you who is logged in and what terminal device they are using.
$ w 11:46PM up 3:23, 2 users, load averages: 1.45, 0.94, 0.71 USER TTY FROM LOGIN@ IDLE WHAT user1 p0 :0.0 9:01PM 0 -ksh user2 p1 :0.0 11:42PM 0 w
$ who user1 ttyp0 Jul 11 21:01 (:0.0) user2 ttyp1 Jul 11 23:42 (:0.0)
To see who you logged in as, use
To see what user you currently are, you can use
echo $USER or