From owner-freebsd-questions@freebsd.org Fri Dec 18 03:16:03 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BDE54AD36E for ; Fri, 18 Dec 2020 03:16:03 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CxvC56cfNz3Qx0 for ; Fri, 18 Dec 2020 03:16:01 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.27.208]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPA (Nemesis) id 1MHoAg-1ktxac2WJi-00EvCY; Fri, 18 Dec 2020 04:15:48 +0100 Date: Fri, 18 Dec 2020 04:15:48 +0100 From: Polytropon To: Jos Chrispijn Cc: FreeBSD Mailing List Subject: Re: Login user status Message-Id: <20201218041548.3b14af1d.freebsd@edvax.de> In-Reply-To: <6a3ead3e-fec6-7a58-7ad2-c9af0fbf0de9@cloudzeeland.nl> References: <6a3ead3e-fec6-7a58-7ad2-c9af0fbf0de9@cloudzeeland.nl> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:NsKWxZTU4Dlw11qkrdxj9qyDaDBJeNSqgRjeLpV//1/cv0lUObz 6tElduyLJ8qtCQHNmorpYH4+pbJmNJWoqQjmyQ0sAwMWu6VPyXZu6kfAiDqIr3mjHq2jZdK FFRizuQUQFXEzGeBzzY2eUpM0HbtNc6zIW70+RGmpYlBMP2bueU3ut1VykwKJjzEgWhORMV BN0nwV5IeFvtzgaXOQlTg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:MWgYVJ8wr3g=:b31xBh32RAEqxIw0J3J4O5 NUOXyAMRHBHm/trOxW/8/GarpR6IR3Blyslc+BOVqkUACiqAE3ajbfVKQoLOycUdeeFWwG/m/ UAjMg4VhO6sfr9yCdypBlD8ekPEYDCsX2La8BtTIxt3GK13g1bQV9m1Z4I7f3m63nBfOGH0LI jiaBpCia0W/kQh1kXeSB4Cn3E1sX77bM10+7nBvZQ8/eqQXkLy5A8gu7PWzPbPoCoJm/Awdk7 kbQbKuq0wXlNhPeu4nIFQMEl3U7bv44Y94csS40HohLpKjby95RrTGrUO8XC9fqUstXZ5/U2G cyDh7/l8vAYlNeqIQJ33cB3aWOXMACi53A12ILouQ+/LE2ALQB8jiBRYCe7bOOmLvAprfJG0d Q6Ar1zrgjYCWTxVhzBmzme3X7fnnmsVb+DW0JTyNgWHn2Kq2u/PNrMuCTY/v7 X-Rspamd-Queue-Id: 4CxvC56cfNz3Qx0 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 212.227.126.130) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [-0.32 / 15.00]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.72)[-0.724]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[94.222.27.208:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.227.126.130:from]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[212.227.126.130:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[212.227.126.130:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.126.130:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 03:16:03 -0000 On Fri, 18 Dec 2020 00:03:37 +0100, Jos Chrispijn wrote: > When I login to my BSD server, I do that with a regular user account and > swith then to my admin account. > What I don't understand is that if I use the 'who' query from the > prompt, only the regular username is shown where it also should show the > root user being logged in. > Can you tell me what causes this behavior? This is the normal and expected behaviour. The context "logged in" is true for those users who use the login program to log in, i. e., any regular interactive users. When you "switch to" an admin user, typically root, by using "su -" (or "su -m"), such a login is not performed. Instead, the execution environment is altered and only a new shell instance is started. >From "man su": By default, the environment is unmodified with the exception of USER, HOME, and SHELL. HOME and SHELL are set to the target login's default values. USER is set to the target login, unless the target login has a user ID of 0, in which case it is unmodified. The invoked shell is the one belonging to the target login. This is the traditional behavior of su. Resource limits and session priority applicable to the original user's login class (see login.conf(5)) are also normally retained unless the target login has a user ID of 0. As you can see, nothing actually creates a new login entry in a way that the "who" program could pick that up. If you use a program like "htop" and press PF5 (process tree), you can see that the "root session" is just a subprocess of the "user (login) session". Programs like "w" behave the same way and do not display the root user as being logged in - because it isn't. You can find more information in "man who" and "man login". -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...