From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 17 13:58:37 2013 Received: (at submit) by debbugs.gnu.org; 17 Feb 2013 18:58:37 +0000 Received: from localhost ([127.0.0.1]:33318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U79Rc-0005Yw-SV for submit@debbugs.gnu.org; Sun, 17 Feb 2013 13:58:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51984) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U77ir-00036Q-15 for submit@debbugs.gnu.org; Sun, 17 Feb 2013 12:08:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U77hw-0000U3-PM for submit@debbugs.gnu.org; Sun, 17 Feb 2013 12:07:22 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:47317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U77hw-0000Ts-Jq for submit@debbugs.gnu.org; Sun, 17 Feb 2013 12:07:20 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U77hq-0006cB-4i for bug-coreutils@gnu.org; Sun, 17 Feb 2013 12:07:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U77hk-0000Rc-In for bug-coreutils@gnu.org; Sun, 17 Feb 2013 12:07:10 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U77hk-0000RM-2Q for bug-coreutils@gnu.org; Sun, 17 Feb 2013 12:07:08 -0500 Received: by mail-lb0-f182.google.com with SMTP id gg6so3677504lbb.41 for ; Sun, 17 Feb 2013 09:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=YSGCql7/+/X6SDFrTVmkRx9g10wQi5XhG16rsgSlF80=; b=vQxi4QQnryilGbGV21AqtNscKKhd2PETotLfYV/bNJUO6nInv4jxjuWIxkXum6t9iL yvr0vTqgtAZWzw0CpDHAiOTtCDvn2gfj4auay8tad5cPbHvxkNv896jWM70nmvfEkL2L Sd7MmZZPQo1AYpbd0i0phNhccYdKpygHBwDLcd8he+JuRDpl/B6w43lwHsXfHOw9l8GU YnZAkhLjhYcbOEMy+jjHJ0wtnuB4fFMqFYkADHwTBqnNgB+Zzn0LvqqgF/Xdk17Jyxb+ TZSGL1fhTIIa4aXo/3M4wfPImZr36Km4rfJoUJzppeESvpicpG27Z4J7dHoDI03wtNNq J5Og== X-Received: by 10.112.87.105 with SMTP id w9mr4483060lbz.14.1361120825552; Sun, 17 Feb 2013 09:07:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.156.38 with HTTP; Sun, 17 Feb 2013 09:06:45 -0800 (PST) From: anatoly techtonik Date: Sun, 17 Feb 2013 20:06:45 +0300 Message-ID: Subject: Add --all option to 'users' command To: bug-coreutils Content-Type: multipart/alternative; boundary=bcaec554e1064db0b304d5eea3bf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 17 Feb 2013 13:58:33 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --bcaec554e1064db0b304d5eea3bf Content-Type: text/plain; charset=UTF-8 The 'users' command shows users who are currently online. It will be nice to have --all option to show all users. -- anatoly t. --bcaec554e1064db0b304d5eea3bf Content-Type: text/html; charset=UTF-8
The 'users' command shows users who are currently online. It will be nice to have --all option to show all users.
--
anatoly t.
--bcaec554e1064db0b304d5eea3bf-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 00:49:21 2013 Received: (at 13738) by debbugs.gnu.org; 18 Feb 2013 05:49:21 +0000 Received: from localhost ([127.0.0.1]:33717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7JbM-00054l-M1 for submit@debbugs.gnu.org; Mon, 18 Feb 2013 00:49:20 -0500 Received: from joseki.proulx.com ([216.17.153.58]:33075) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7JbL-00054b-L5; Mon, 18 Feb 2013 00:49:20 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 84A05211DA; Sun, 17 Feb 2013 22:48:21 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 6E22A2DCDD; Sun, 17 Feb 2013 22:48:21 -0700 (MST) Date: Sun, 17 Feb 2013 22:48:21 -0700 From: Bob Proulx To: anatoly techtonik Subject: Re: bug#13738: Add --all option to 'users' command Message-ID: <20130218054821.GB10302@hysteria.proulx.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.6 (/) tag 13738 + moreinfo thanks anatoly techtonik wrote: > The 'users' command shows users who are currently online. It will be nice > to have --all option to show all users. Do you mean the equivelent to this? $ getent passwd | awk -F: '{print$1}' Bob From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 02:47:44 2013 Received: (at 13738) by debbugs.gnu.org; 18 Feb 2013 07:47:44 +0000 Received: from localhost ([127.0.0.1]:33769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7LRv-0000jS-41 for submit@debbugs.gnu.org; Mon, 18 Feb 2013 02:47:43 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:47213) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7LRn-0000ia-Nv for 13738@debbugs.gnu.org; Mon, 18 Feb 2013 02:47:38 -0500 Received: by mail-lb0-f171.google.com with SMTP id gg13so4095229lbb.16 for <13738@debbugs.gnu.org>; Sun, 17 Feb 2013 23:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=sX++DpiSczpdPENBLnZJt5AleE3NIR7GVq2a69ZL9do=; b=g8b8DRybtid0B/7DvvLkl9Q7WIs7VQsUK9b0B+nt1rOk842Ri1VNg+IdtoaMco0mVN 9AzBWaqOREP1FkA8nl7Hz7sjeSqMUHZi77W8I0U2QzALa3zntjS/ign49Up6P3zvCiRD CIpZr/eQ6GdFcMlLtW528LM32fThWkq/O9Y4clOxQp90xbZHRMUhE0FGXGlY8+iaPKwy nYC5dOQTWH2zyrZjzRF4x45+TVTI1x8lJ57qzBkAuFLKQ84vpjfS5lfIdTV1d4CXKIoU 6HjocJBXLeV6R/akryLzB2S5We0f7opebaV6xKrMgeb4CrCSlypAk3LtFizwrLqlGnej a3KA== X-Received: by 10.112.29.1 with SMTP id f1mr5332919lbh.30.1361173596285; Sun, 17 Feb 2013 23:46:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.156.38 with HTTP; Sun, 17 Feb 2013 23:46:16 -0800 (PST) In-Reply-To: <20130218054821.GB10302@hysteria.proulx.com> References: <20130218054821.GB10302@hysteria.proulx.com> From: anatoly techtonik Date: Mon, 18 Feb 2013 10:46:16 +0300 Message-ID: Subject: Re: bug#13738: Add --all option to 'users' command To: Bob Proulx Content-Type: multipart/alternative; boundary=bcaec554e14caf2b9d04d5faec7b X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) --bcaec554e14caf2b9d04d5faec7b Content-Type: text/plain; charset=UTF-8 On Mon, Feb 18, 2013 at 8:48 AM, Bob Proulx wrote: > tag 13738 + moreinfo > thanks > > anatoly techtonik wrote: > > The 'users' command shows users who are currently online. It will be nice > > to have --all option to show all users. > > Do you mean the equivelent to this? > > $ getent passwd | awk -F: '{print$1}' > Yes. And also - the equivalent of this as it appeared more useful: $ cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 http://askubuntu.com/questions/257421/list-all-human-users/257451 -- anatoly t. --bcaec554e14caf2b9d04d5faec7b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On M= on, Feb 18, 2013 at 8:48 AM, Bob Proulx <bob@proulx.com> wrote:=
tag 13738 + moreinfo
thanks

anatoly techtonik wrote:
> The 'users' command shows users who are currently online. It w= ill be nice
> to have --all option to show all users.

Do you mean the equivelent to this?

=C2=A0 $ getent passwd | awk -F: '{print$1}'
<= br>
Yes. And also - the equivalent of this as it appeared m= ore useful:
$ cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' |= cut -d: -f1

=C2=A0
--bcaec554e14caf2b9d04d5faec7b-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 16:00:11 2013 Received: (at control) by debbugs.gnu.org; 18 Feb 2013 21:00:11 +0000 Received: from localhost ([127.0.0.1]:35238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7Xop-0006g5-4m for submit@debbugs.gnu.org; Mon, 18 Feb 2013 16:00:11 -0500 Received: from joseki.proulx.com ([216.17.153.58]:36379) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7Xon-0006fy-0H for control@debbugs.gnu.org; Mon, 18 Feb 2013 16:00:09 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id A9E7C211D5 for ; Mon, 18 Feb 2013 13:59:06 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 80D6D2DCDD; Mon, 18 Feb 2013 13:59:06 -0700 (MST) Date: Mon, 18 Feb 2013 13:59:06 -0700 From: Bob Proulx To: control@debbugs.gnu.org Subject: mark as wishlist Message-ID: <20130218205906.GA27932@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.2 (/) severity 13738 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 16:02:09 2013 Received: (at 13738) by debbugs.gnu.org; 18 Feb 2013 21:02:09 +0000 Received: from localhost ([127.0.0.1]:35243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7Xqi-0006jB-PP for submit@debbugs.gnu.org; Mon, 18 Feb 2013 16:02:09 -0500 Received: from joseki.proulx.com ([216.17.153.58]:36389) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7Xqf-0006j3-TN for 13738@debbugs.gnu.org; Mon, 18 Feb 2013 16:02:07 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 25672211D5; Mon, 18 Feb 2013 14:01:04 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id F0ABF2DCDD; Mon, 18 Feb 2013 14:01:03 -0700 (MST) Date: Mon, 18 Feb 2013 14:01:03 -0700 From: Bob Proulx To: anatoly techtonik Subject: Re: bug#13738: Add --all option to 'users' command Message-ID: <20130218210103.GA23311@hysteria.proulx.com> References: <20130218054821.GB10302@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.6 (/) anatoly techtonik wrote: > Bob Proulx wrote: > > anatoly techtonik wrote: > > > The 'users' command shows users who are currently online. It will be nice > > > to have --all option to show all users. > > > > Do you mean the equivelent to this? > > > > $ getent passwd | awk -F: '{print$1}' > > Yes. And also - the equivalent of this as it appeared more useful: > $ cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 That is an incorrect implementation. It's buggy. > http://askubuntu.com/questions/257421/list-all-human-users/257451 I looked at that reference and it says this: > Human users have UIDs starting at 1000, That assumption is incorrect. Many systems start users off at 100. Many others start users at 500. There isn't any univerial standard. It is a local system configuration option. > so you can use that fact to filter out the non-humans: > > cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 This assumes that /etc/passwd is the user database. While true on a typical standalone system it is incorrect when NIS/yp or LDAP or other account system is in use. That is why I used 'getent passwd' even though it is not available on all systems. When available it obeys the local system configuration and returns the correct information. > This cuts the first (username) and third (UID) colon-delimited fields > from /etc/passwd, then filters for the resulting lines which end with > a colon and four digits, then cuts the first (username) field from > that, leaving you with a list of users with UIDs between 1000 and > 9999. > > If you have more than nine thousand users on your system, this will > fail - but it's necessary to restrict the result to 4-digit UIDs in > order not to catch nobody (UID 65534). The above is admittedly incorrect when users have uids larger than 9999. But users with larger uids are very common. I know several organizations that assign the user's phone number as their uid for example as a way to simplify coordination. Printing only four digit uids would be unsuitable. In order to list users but avoid listing certain specific users the typical way used by NIS/yp for example is to set a min and a max uid value in the nis/yp configuration. $ ypcat passwd # avoids listing below MINUID / above MAXUID (example) Which means something like this would be needed. $ getent passwd | awk -F: -v minuid=1000 -v maxuid=65533 'minuid <= $3 && $3 <= maxuid { print $1 }' Where the values 1000 and 65533 would be local system definable values. Actually even that isn't sufficient. The value for nobody 65534 is a traditional value. But uids may be larger on most modern systems. It isn't unusual to have the nobody id in the middle of the range with real users having uid numbers both less than and greater than that value. Therefore in order to be completely correct additional filter methods would be needed such as sets of ranges or block lists or something similar. Solving the problem in general gets messy very quickly. It is therefore one of those that is better solved locally by providing the tools needed to do what is needed on a case by case basis. So far after forty years of Unix and GNU systems this hasn't been needed and therefore the use cases must be unusual. The philosophy isn't to solve all problems but just to make all problems solvable. It would help if you could say a few words about the case in which this would be helpful? Bob From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 18 01:30:20 2019 Received: (at 13738) by debbugs.gnu.org; 18 Jan 2019 06:30:20 +0000 Received: from localhost ([127.0.0.1]:35561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gkNfX-0008Mc-IW for submit@debbugs.gnu.org; Fri, 18 Jan 2019 01:30:19 -0500 Received: from mail-pf1-f180.google.com ([209.85.210.180]:35912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gkNfV-0008EZ-1K; Fri, 18 Jan 2019 01:30:17 -0500 Received: by mail-pf1-f180.google.com with SMTP id b85so6082260pfc.3; Thu, 17 Jan 2019 22:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Gfe6RT1G2C/mGHbT9ulMO3HZI56mv3+P0PyYiPHT9Wk=; b=DWNbB1vZIbi+vSv0FhUSS3CAIA1FWscISaL3X9IoJTZjoz8TC+lN+rcw3OEL+pWKSV heY6pajND6ChSJOaR5ifyy2AWamn+OeiybomhPcDPB1ZpeemOcjmAQs9Kzm+8Uvb1FTT A305rnluxdYjScMjkpcwyQJU6TbUuo1eciSiV+bK5wbx62jALg1kRHg3uj/67E40Qjzb pytcYluQbH7nCyrh62/XtzhDnvf8hr258321cN4XIYPkeKiYZo/Fwkq0mfHyzwqmREcM 4TCD84SijHaPbsnWvIP/ozz6MHUUOdhtLn79pSpkRMEYxz5j9fompd8oNbbqZ6W2n7Vi QA2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Gfe6RT1G2C/mGHbT9ulMO3HZI56mv3+P0PyYiPHT9Wk=; b=W5MqI3qAd66pvueufjIqNZCcr7XuRPpOUvs6ptKfAwVH7V29eyJ8zQ8pAwrG7HygBk tJB3UkOtGp4FVi7U4Pc+9Kb1g5u+T+IrZplP49UNWHLhLBNWjlL/+/ivC0qS6ao2fk2E yJ438qhBt/oOGec5KBgwi8o7YIXSAU8duHJyk1qCpjutJVQJcUkzMC0+f2c3JEaelnci dQWRwN+SyPhwF55k6WXYgnPJtuP+rE2EXdmrprSD1Z93KZ1khMEEF+2nWjkNd0dgJVQs OsPvOHFuv9E2o60M9/38QvUSoEtmXOocxqi1GRPVRpaFca4VPT9w1eomeIbYKeUYD8Ip Ya7w== X-Gm-Message-State: AJcUukdnTLyC47UND8JBmFafcW32vutD1a7eeegtIa7BhgIV6nWlpbdF HkqZeN5lcDTTbBZJgleYPkAmx18Q X-Google-Smtp-Source: ALg8bN43Xfl4v0vm2Ju8nXEg9h/KLvKd12M4J0+wv+qdyKkcFBvnc+97b8fZvxYQS6SigHAGFTxDRQ== X-Received: by 2002:a63:7154:: with SMTP id b20mr16324612pgn.342.1547793010481; Thu, 17 Jan 2019 22:30:10 -0800 (PST) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id c23sm4541218pfi.83.2019.01.17.22.30.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 22:30:09 -0800 (PST) Subject: Re: bug#13738: Add --all option to 'users' command To: anatoly techtonik References: <20130218054821.GB10302@hysteria.proulx.com> <20130218210103.GA23311@hysteria.proulx.com> From: Assaf Gordon Message-ID: <3550217a-7428-1bb3-3d22-d3895d67e6f7@gmail.com> Date: Thu, 17 Jan 2019 23:30:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20130218210103.GA23311@hysteria.proulx.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 13738 wontfix close 13738 stop (triaging old bugs) Hello, On 2013-02-18 2:01 p.m., Bob Proulx wrote: > anatoly techtonik wrote: >> Bob Proulx wrote: >>> anatoly techtonik wrote: >>>> The 'users' command shows users who are currently online. It will be nice >>>> to have --all option to show all users. >>> >>> Do you mean the equivelent to this? >>> >>> $ getent passwd | awk -F: '{print$1}' >> [....] > Solving the problem in general gets messy very quickly. It is > therefore one of those that is better solved locally by providing the > tools needed to do what is needed on a case by case basis. So far > after forty years of Unix and GNU systems this hasn't been needed and > therefore the use cases must be unusual. The philosophy isn't to > solve all problems but just to make all problems solvable. > > It would help if you could say a few words about the case in > which this would be helpful? With no further comments in almost 6 years, and this item already listed under our "rejected requests" page, I'm closing this as "won't fix". regards, - assaf From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 10 08:42:32 2019 Received: (at 13738) by debbugs.gnu.org; 10 Feb 2019 13:42:32 +0000 Received: from localhost ([127.0.0.1]:41839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gspNP-00014S-VE for submit@debbugs.gnu.org; Sun, 10 Feb 2019 08:42:32 -0500 Received: from mail-ed1-f43.google.com ([209.85.208.43]:33292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gspNL-00014C-AJ for 13738@debbugs.gnu.org; Sun, 10 Feb 2019 08:42:29 -0500 Received: by mail-ed1-f43.google.com with SMTP id a2so6610106edi.0 for <13738@debbugs.gnu.org>; Sun, 10 Feb 2019 05:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1+2eWp1ixS6p0qpg0gJPNB0jwau0i1yzN3MBkhZ7VIM=; b=qgYsSkiYmvyLXXdkRfbkr+hBZt0dMDLRhd6oZfmBU4UePwU65pzEwuIU33ADGDuM+U 6bfoBVOFo8mzbOr5MD2vK9jhxf+G1SXiJZO717hzIXNOjbWdlMzx33K6eC9l7HHl2cni 0dnOQVxQdz72i0Lccuj8MrsvtWpu684UwIiNmHdU8377Z0j4g/Huuv6//jhHgkgW9iBA exKIw2vIZW/5/1L9HFjX44WEwc7oxMB45SRx3tEJZS9drGXmUrqyJkPKxoEa8mok4vQM MUqR/SlngWvPfLs8ytyp5D+FR+1jdohSfY3lOeUg3O2og/N8+kh5h3bvOGeZOfq5PLdr +TVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1+2eWp1ixS6p0qpg0gJPNB0jwau0i1yzN3MBkhZ7VIM=; b=Hz8jHMen9b5Ep+9UoX+CkUEAvkk5VKodQzuyZCme3f+Qxi3oeYcpXPgQ7cnV34mZgL YH1gavxXoJLWegV0CNHXKh4u32KE+31DpwPU25YvEMPHSPhOgOkhWTKQ0mek+Ybw8Z1v cIaZKYk0UiXlzlW18Yhs+aI7LHUKkwJnkQhPD8r5IcPD5iR06+m6rmTfXBPKuJHtz2hq ut2ilVZZaGezqhTrNc/3w9MEX8MJsRpEUBY5SOZhVTUKQdpKtaoZtzOmbxofXf6crAV8 5z9qLR/TDzxqMHTKVJQfSxU9EQkLxKOeYGKcGTboM0p8ZSiOhhi6+0+1dgYYzd47+K7S sAeg== X-Gm-Message-State: AHQUAuakQF61+VQPG8QJ2wWTfslEa8NGBLh3bX3bUk0kl3MXivmVdhyI QIOi0kuj+vJ7zQmxwOjttxLuZ6fF3m1+HPJ+F20= X-Google-Smtp-Source: AHgI3Ia1IEw6AlLSuRyvlBrZMHMwR+oZkQSs0KzsiKGZkggGYEWgLU6mcyIvUogk20kUSvBMf8vdFWFQ4WCqHnBO46A= X-Received: by 2002:a17:906:1d0d:: with SMTP id n13mr17652545ejh.23.1549806141304; Sun, 10 Feb 2019 05:42:21 -0800 (PST) MIME-Version: 1.0 References: <20130218054821.GB10302@hysteria.proulx.com> <20130218210103.GA23311@hysteria.proulx.com> In-Reply-To: <20130218210103.GA23311@hysteria.proulx.com> From: anatoly techtonik Date: Sun, 10 Feb 2019 16:42:03 +0300 Message-ID: Subject: Re: bug#13738: Add --all option to 'users' command To: Bob Proulx Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, Feb 19, 2013 at 12:01 AM Bob Proulx wrote: > > anatoly techtonik wrote: > > Bob Proulx wrote: > > > anatoly techtonik wrote: > > > > The 'users' command shows users who are currently online. It will be nice > > > > to have --all option to show all users. > > > > > > Do you mean the equivelent to this? > > > > > > $ getent passwd | awk -F: '{print$1}' > > > > Yes. And also - the equivalent of this as it appeared more useful: > > $ cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 > > That is an incorrect implementation. It's buggy. > > > http://askubuntu.com/questions/257421/list-all-human-users/257451 > > I looked at that reference and it says this: > > > Human users have UIDs starting at 1000, > > That assumption is incorrect. Many systems start users off at 100. > Many others start users at 500. There isn't any univerial standard. > It is a local system configuration option. How to figure out at which number users UIDs start at a given system? > > so you can use that fact to filter out the non-humans: > > > > cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 > > This assumes that /etc/passwd is the user database. While true on a > typical standalone system it is incorrect when NIS/yp or LDAP or other > account system is in use. That is why I used 'getent passwd' even > though it is not available on all systems. When available it obeys > the local system configuration and returns the correct information. If NIS/yp or LDAP are installed, they provide getent, right? So if there is no getent, then /etc/passwd is de-facto database and can be reliably used as a fallback. Is that correct? > > This cuts the first (username) and third (UID) colon-delimited fields > > from /etc/passwd, then filters for the resulting lines which end with > > a colon and four digits, then cuts the first (username) field from > > that, leaving you with a list of users with UIDs between 1000 and > > 9999. > > > > If you have more than nine thousand users on your system, this will > > fail - but it's necessary to restrict the result to 4-digit UIDs in > > order not to catch nobody (UID 65534). > > The above is admittedly incorrect when users have uids larger than > 9999. But users with larger uids are very common. I know several > organizations that assign the user's phone number as their uid for > example as a way to simplify coordination. Printing only four digit > uids would be unsuitable. > > In order to list users but avoid listing certain specific users the > typical way used by NIS/yp for example is to set a min and a max uid > value in the nis/yp configuration. > > $ ypcat passwd # avoids listing below MINUID / above MAXUID (example) > > Which means something like this would be needed. > > $ getent passwd | awk -F: -v minuid=1000 -v maxuid=65533 'minuid <= $3 && $3 <= maxuid { print $1 }' > > Where the values 1000 and 65533 would be local system definable values. Is there other way to distinguish user accounts other than matching "things that only seem to be true", like UID numbers? > Actually even that isn't sufficient. The value for nobody 65534 is a > traditional value. But uids may be larger on most modern systems. It > isn't unusual to have the nobody id in the middle of the range with > real users having uid numbers both less than and greater than that > value. Therefore in order to be completely correct additional filter > methods would be needed such as sets of ranges or block lists or > something similar. Yes. I believe LXD has UID mapping for containers about 100000, and those are not human users in general case. > Solving the problem in general gets messy very quickly. It is > therefore one of those that is better solved locally by providing the > tools needed to do what is needed on a case by case basis. So far > after forty years of Unix and GNU systems this hasn't been needed and > therefore the use cases must be unusual. The philosophy isn't to > solve all problems but just to make all problems solvable. I guess appeal to tradition in the major argument in Linux reasoning. ) I am getting the feeling that the approach of solving problems be using the tool for specific case is misleading in the case that it battles with effects and not the causes. The cause of the mess if UID mapping in Linux kernel, which is not about users at all. There is a concept of user space, but correct me if I wrong - daemons that run with different UIDs are run in their own userspace as well. The user concept is not defined by kernel, but rather by some concept of having home and being able to login into it either from console or remotely. If this behavior of humans vs daemons was explicitly documented somewhere, it could lead to better understanding if solving this problem in general is real. > It would help if you could say a few words about the case in > which this would be helpful? Sorry that I've missed the reply. The case is to see if there are any alive users on the systems I manage or help with. An easy way to check servers for accounts left from former developers. -- anatoly t. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 10 15:23:27 2019 Received: (at 13738) by debbugs.gnu.org; 10 Feb 2019 20:23:27 +0000 Received: from localhost ([127.0.0.1]:42810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gsvdN-0002Ta-6n for submit@debbugs.gnu.org; Sun, 10 Feb 2019 15:23:27 -0500 Received: from havoc.proulx.com ([96.88.95.61]:51604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gsvdL-0002TI-1M for 13738@debbugs.gnu.org; Sun, 10 Feb 2019 15:23:23 -0500 Received: from joseki.proulx.com (localhost [127.0.0.1]) by havoc.proulx.com (Postfix) with ESMTP id 9CAD32BCF; Sun, 10 Feb 2019 13:23:16 -0700 (MST) Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 712C321243; Sun, 10 Feb 2019 13:23:16 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 692A22DC80; Sun, 10 Feb 2019 13:23:16 -0700 (MST) Date: Sun, 10 Feb 2019 13:23:16 -0700 From: Bob Proulx To: anatoly techtonik Subject: Re: bug#13738: Add --all option to 'users' command Message-ID: <20190210124741574765921@bob.proulx.com> References: <20130218054821.GB10302@hysteria.proulx.com> <20130218210103.GA23311@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13738 Cc: 13738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) anatoly techtonik wrote: > Bob Proulx wrote: > > > Human users have UIDs starting at 1000, > > > > That assumption is incorrect. Many systems start users off at 100. > > Many others start users at 500. There isn't any univerial standard. > > It is a local system configuration option. > > How to figure out at which number users UIDs start at a given system? That is a system dependent problem. On my Debian Stretch 9 system the /etc/login.defs file contains: # Min/max values for automatic uid selection in useradd # UID_MIN 1000 UID_MAX 60000 # System accounts #SYS_UID_MIN 100 #SYS_UID_MAX 999 Other systems will be different. It is a policy implemented by the OS. > > > so you can use that fact to filter out the non-humans: > > > > > > cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 > > > > This assumes that /etc/passwd is the user database. While true on a > > typical standalone system it is incorrect when NIS/yp or LDAP or other > > account system is in use. That is why I used 'getent passwd' even > > though it is not available on all systems. When available it obeys > > the local system configuration and returns the correct information. > > If NIS/yp or LDAP are installed, they provide getent, right? 'getent' is actually AFAIK a glibc utility. AFAIK any OS using glibc will provide it. However traditional systems not based on glibc may or may not. I only have limited access to other systems at this time and have no easy way to check *BSD or HP-UX or others for example. > So if there is no getent, then /etc/passwd is de-facto database and > can be reliably used as a fallback. Is that correct? The /etc/nsswitch.conf file determines this. Certainly the lowest level default is /etc/passwd. But the nsswitch.conf file is where modifications are configured for this. > Is there other way to distinguish user accounts other than matching > "things that only seem to be true", like UID numbers? There is no actual difference between user accounts and system accounts. The only real difference is that user accounts have a human user associated with them but system accounts do not. Other than that they are the same. Certainly to the OS they are simply a uid to hold a running process. > > Actually even that isn't sufficient. The value for nobody 65534 is a > > traditional value. But uids may be larger on most modern systems. It > > isn't unusual to have the nobody id in the middle of the range with > > real users having uid numbers both less than and greater than that > > value. Therefore in order to be completely correct additional filter > > methods would be needed such as sets of ranges or block lists or > > something similar. > > Yes. I believe LXD has UID mapping for containers about 100000, > and those are not human users in general case. That is a good example. And one of which I was not aware. And I am sure there are other cases too. > I am getting the feeling that the approach of solving problems be using > the tool for specific case is misleading in the case that it battles with > effects and not the causes. The cause of the mess if UID mapping in > Linux kernel, which is not about users at all. There is a concept of user > space, but correct me if I wrong - daemons that run with different UIDs > are run in their own userspace as well. The user concept is not defined > by kernel, but rather by some concept of having home and being able to > login into it either from console or remotely. All processes have a uid. Some uids are associated with a human. Some are not. The kernel doesn't know the difference. The kernel is applying permissions based upon nothing more than the integer number of the process. For example the uid can send a signal to another process with the same uid. Or the superuser process can send a signal to any other process regardless of uid. But a non-superuser process cannot send a signal to another random process of a different uid. None of which has any relation to whether a human can log into the account or not. > If this behavior of humans vs daemons was explicitly documented > somewhere, it could lead to better understanding if solving this problem > in general is real. I don't think this is possible because there really is no difference between system uids and non-system uids. Whether something is a system uid or a non-system uid is a color we paint on it by human judgement and two different people might judge the same thing differently and both would be right. It is also a difference which makes no difference. > > It would help if you could say a few words about the case in > > which this would be helpful? > > Sorry that I've missed the reply. The case is to see if there are any > alive users on the systems I manage or help with. An easy way to > check servers for accounts left from former developers. You are looking for a list of stale accounts that might be removed? If I were doing such a thing I would look at users with a $HOME directory in the known /home directory path. (Noting that even that is not universial. It's a new convention in the grand scheme of things. /users was previously the ad-hoc standard before /home. Also I know many systems where the admin has configured $HOME locations to exist in /u or elsewhere.) I would create a script program that looked at all accounts with a home in the user home directory. That would be my working list. Then from that I would look at the timestamp of the home directory and look for very old accounts. Because logging into the system has so many effects such as updating the shell .*history files and other things the home directory is almost always updated. This is a very ad-hoc approach but one that I think would be very effective. Especially if it were simply generating a list of user candidates for review for removal. Any extra non-users with accounts in /home could simply be ignored. For example something like this. #!/bin/sh # List users on a system. Assumes /home is used. PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin umask 02 for d in /home/*; do test "$d" != "lost+found" || continue # skip lost+found u="$(basename "$d")" # user name associated with home directory getent passwd "$u" >/dev/null || continue # skip if not an active user homedir=$(getent passwd "$u" | awk -F: '{print$6}') : homedir=$homedir # for sh -x debug tracing case $homedir in /home/*) : okay ;; *) continue ;; # skip home dirs elsewhere esac printf "%s\n" "$u" done exit 0 This can get more complicated when one starts looking at locked accounts, disabled accounts, accounts with expired passwords, and so forth. But it also might be enough just by itself. Bob From unknown Sun Jun 22 04:18:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 11 Mar 2019 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator