{"id":72,"date":"2024-03-30T10:00:22","date_gmt":"2024-03-30T18:00:22","guid":{"rendered":"https:\/\/salemdata.net\/johnpress\/?p=72"},"modified":"2024-03-31T06:08:56","modified_gmt":"2024-03-31T14:08:56","slug":"neat-tidy-etc-group","status":"publish","type":"post","link":"https:\/\/salemdata.net\/johnpress\/?p=72","title":{"rendered":"Neat &#038; Tidy \/etc\/group"},"content":{"rendered":"\n<p>Here&#8217;s a way to keep your<code> \/etc\/group<\/code> file &#8220;neat and tidy&#8221; (Gentoo wiki re: <a href=\"https:\/\/wiki.gentoo.org\/wiki\/Complete_Virtual_Mail_Server\">Complete Virtual Mail Server<\/a>) and ensure that additions to <code>\/etc\/group<\/code> will make numerical sense.<\/p>\n\n\n\n<hr class=\"wp-block-separator alignwide has-alpha-channel-opacity\"\/>\n\n\n\n<p>Below is from my <a href=\"http:\/\/dokuwiki.org\">Dokuwiki <\/a>page re: sort with redactions (v. 2024\/03\/30 17:20)<\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"en\" dir=\"ltr\">\n<head>\n  <meta charset=\"utf-8\" \/>\n  <title>sort<\/title>\n<meta name=\"generator\" content=\"DokuWiki\"\/>\n<meta name=\"theme-color\" content=\"#008800\"\/>\n<meta name=\"robots\" content=\"noindex,nofollow\"\/>\n<meta name=\"keywords\" content=\"sort\"\/>\n<link rel=\"search\" type=\"application\/opensearchdescription+xml\" href=\"\/dokuwiki\/lib\/exe\/opensearch.php\" title=\"Technology Wiki\"\/>\n<link rel=\"start\" href=\"\/dokuwiki\/\"\/>\n<link rel=\"contents\" href=\"\/dokuwiki\/doku.php?id=sort&amp;do=index\" title=\"Sitemap\"\/>\n<link rel=\"manifest\" href=\"\/dokuwiki\/lib\/exe\/manifest.php\"\/>\n<link rel=\"alternate\" type=\"application\/rss+xml\" title=\"Recent Changes\" href=\"\/dokuwiki\/feed.php\"\/>\n<link rel=\"alternate\" type=\"application\/rss+xml\" title=\"Current namespace\" href=\"\/dokuwiki\/feed.php?mode=list&amp;ns=\"\/>\n<link rel=\"alternate\" type=\"text\/html\" title=\"Plain HTML\" href=\"\/dokuwiki\/doku.php?do=export_xhtml&amp;id=sort\"\/>\n<link rel=\"alternate\" type=\"text\/plain\" title=\"Wiki Markup\" href=\"\/dokuwiki\/doku.php?do=export_raw&amp;id=sort\"\/>\n<link rel=\"canonical\" href=\"http:\/\/ares\/dokuwiki\/doku.php?id=sort\"\/>\n<link rel=\"stylesheet\" href=\"\/dokuwiki\/lib\/exe\/css.php?t=dokuwiki&amp;tseed=95dba48de7814be7b76119b41dff17a9\"\/>\n<!--[if gte IE 9]><!-->\n<script >\/*<![CDATA[*\/var NS='';var SIG=\" --- \\\/\\\/[[BOGUS156@gmail.com|John Poole]] 2024\\\/03\\\/30 17:25\\\/\\\/\";var JSINFO = {\"plugin_pdfjs\":{\"hide_download_button\":0},\"id\":\"sort\",\"namespace\":\"\",\"ACT\":\"export_xhtml\",\"useHeadingNavigation\":0,\"useHeadingContent\":0};\n\/*!]]>*\/<\/script>\n<script src=\"\/dokuwiki\/lib\/exe\/jquery.php?tseed=f0349b609f9b91a485af8fd8ecd4aea4\" defer=\"defer\">\/*<![CDATA[*\/\n\/*!]]>*\/<\/script>\n<script src=\"\/dokuwiki\/lib\/exe\/js.php?t=dokuwiki&amp;tseed=95dba48de7814be7b76119b41dff17a9\" defer=\"defer\">\/*<![CDATA[*\/\n\/*!]]>*\/<\/script>\n<script >\/*<![CDATA[*\/document.documentElement.className += ' olCSSsupported';\n\/*!]]>*\/<\/script>\n<script type=\"text\/javascript\" charset=\"utf-8\" src=\"\/dokuwiki\/lib\/plugins\/tablecalc\/script.js\">\/*<![CDATA[*\/\n\/*!]]>*\/<\/script>\n<!--<![endif]-->\n<\/head>\n<body>\n<div class=\"dokuwiki export\">\n<!-- TOC START -->\n<div id=\"dw__toc\" class=\"dw__toc\">\n<h3 class=\"toggle\">Table of Contents<\/h3>\n<div>\n\n<ul class=\"toc\">\n<li class=\"level1\"><div class=\"li\"><a href=\"#sort\">sort<\/a><\/div>\n<ul class=\"toc\">\n<li class=\"level2\"><div class=\"li\"><a href=\"#parameters\">Parameters<\/a><\/div><\/li>\n<li class=\"level2\"><div class=\"li\"><a href=\"#cookbook_recipes\">Cookbook Recipes<\/a><\/div>\n<ul class=\"toc\">\n<li class=\"level3\"><div class=\"li\"><a href=\"#etc_group\">\/etc\/group<\/a><\/div><\/li>\n<\/ul><\/li>\n<\/ul><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<!-- TOC END -->\n\n<h1 class=\"sectionedit1\" id=\"sort\">sort<\/h1>\n<div class=\"level1\">\n\n<\/div>\n<!-- EDIT{&quot;target&quot;:&quot;section&quot;,&quot;name&quot;:&quot;sort&quot;,&quot;hid&quot;:&quot;sort&quot;,&quot;codeblockOffset&quot;:0,&quot;secid&quot;:1,&quot;range&quot;:&quot;1-20&quot;} -->\n<h2 class=\"sectionedit2\" id=\"parameters\">Parameters<\/h2>\n<div class=\"level2\">\n\n<p>\nFrom <code>man sort:<\/code>\n<\/p>\n<pre class=\"code\">-b, --ignore-leading-blanks\n-d, --dictionary-order\n-f, --ignore-case\n-i, --ignore-nonprinting\n-r, --reverse\n\n-k, --key=KEYDEF  sort via a key; KEYDEF gives location and type\n\n       KEYDEF  is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number \n       and C a character position in the field;\n       both are origin 1, and the stop position defaults to the line\u2019s end.  If neither -t nor -b \n       is in effect, characters in a  field  are\n       counted  from  the  beginning  of the preceding whitespace.  OPTS is one or more \n       single-letter ordering options [bdfgiMhnRrV], which\n       override global ordering options for that key.  If no key is given, use the entire line \n       as the key.  Use --debug to diagnose  incorrect key usage.\n\n-t, --field-separator=SEP use SEP instead of non-blank to blank transition\n-u, --unique with -c, check for strict ordering; without -c, output only the first of an equal run\n\n<\/pre>\n\n<\/div>\n<!-- EDIT{&quot;target&quot;:&quot;section&quot;,&quot;name&quot;:&quot;Parameters&quot;,&quot;hid&quot;:&quot;parameters&quot;,&quot;codeblockOffset&quot;:0,&quot;secid&quot;:2,&quot;range&quot;:&quot;21-1040&quot;} -->\n<h2 class=\"sectionedit3\" id=\"cookbook_recipes\">Cookbook Recipes<\/h2>\n<div class=\"level2\">\n\n<\/div>\n<!-- EDIT{&quot;target&quot;:&quot;section&quot;,&quot;name&quot;:&quot;Cookbook Recipes&quot;,&quot;hid&quot;:&quot;cookbook_recipes&quot;,&quot;codeblockOffset&quot;:1,&quot;secid&quot;:3,&quot;range&quot;:&quot;1041-1070&quot;} -->\n<h3 class=\"sectionedit4\" id=\"etc_group\">\/etc\/group<\/h3>\n<div class=\"level3\">\n\n<p>\nTo list by the ID.  This can be helpful to restructures since the process that creates a new entry will look to the value at the end of the file and increment it by 1, so the outer high values should be tucked in before the area were user added groups occurs, e.g. 1000+\n<\/p>\n<pre class=\"code\">   sort -k 3 -t : -n \/etc\/group\n   <\/pre>\n\n<\/div>\n\n<h4 id=\"discussion\">Discussion<\/h4>\n<div class=\"level4\">\n\n<p>\nHere is a comparison table.  What triggers the need for re-ordering is that package <code>acct-group\/postfix<\/code> stuck in it&#039;s entry <code><span style='color:#ff7f27; '>vmail:x:5000:<\/span><\/code> at the last place for user entries which will cause any subsequent entry to be number 5001.  We want subsequent entries to be just after 1000, so we moved <code><span style='color:#ff7f27; '>vmail:x:5000:<\/span><\/code> just above the sorted list where number 1000 starts causing the end of the list (excepting the final entries<code> nogroup:x:65533:<\/code> and <code>nobody:x:65534:<\/code>) to be <code>BOGUS3:x:1002:<\/code>\n<\/p>\n<div class=\"table sectionedit5\"><table class=\"inline\">\n\t<thead>\n\t<tr class=\"row0\">\n\t\t<th class=\"col0\">Unmodified<\/th><th class=\"col1\">Sorted<\/th><th class=\"col2\">Ultimately Desired<\/th>\n\t<\/tr>\n\t<\/thead>\n\t<tr class=\"row1\">\n\t\t<td class=\"col0\"><code>root:x:0:root<br\/>\nbin:x:1:root,bin,daemon<br\/>\ndaemon:x:2:root,bin,daemon<br\/>\nsys:x:3:root,bin,adm<br\/>\nadm:x:4:root,adm,daemon<br\/>\ntty:x:5:<br\/>\ndisk:x:6:root,adm<br\/>\nlp:x:7:lp<br\/>\nmem:x:8:<br\/>\nkmem:x:9:<br\/>\nwheel:x:10:root,BOGUS1,BOGUS2<br\/>\nfloppy:x:11:root<br\/>\nnews:x:13:news<br\/>\nuucp:x:14:uucp<br\/>\nconsole:x:17:<br\/>\naudio:x:18:BOGUS1,BOGUS2<br\/>\ncdrom:x:19:<br\/>\ndialout:x:20:<br\/>\ntape:x:26:root<br\/>\nvideo:x:27:root<br\/>\ncdrw:x:80:<br\/>\nusb:x:85:<br\/>\ninput:x:97:<br\/>\nusers:x:100:BOGUS1,BOGUS2,BOGUS3<br\/>\nportage:x:250:<br\/>\nutmp:x:406:<br\/>\nnogroup:x:65533:<br\/>\nnobody:x:65534:<br\/>\nman:x:15:<br\/>\nsshd:x:22:<br\/>\nkvm:x:78:<br\/>\nrender:x:28:<br\/>\nmail:x:12:postfix<br\/>\napache:x:81:BOGUS3<br\/>\npostgres:x:70:<br\/>\nlpadmin:x:106:<br\/>\nBOGUS1:x:1000:<br\/>\nlocate:x:105:<br\/>\nnullmail:x:88:<br\/>\nldap:x:439:<br\/>\ncron:x:16:<br\/>\ncrontab:x:104:<br\/>\nmysql:x:60:<br\/>\nBOGUS2:x:1001:<br\/>\nsgx:x:405:<br\/>\nBOGUS3:x:1002:<br\/>\nftp:x:21:<br\/>\nsmmsp:x:209:<br\/>\nmessagebus:x:101:<br\/>\nntp:x:123:<br\/>\ndovecot:x:76:<br\/>\ndovenull:x:74:<br\/>\npostfix:x:207:<br\/>\npostdrop:x:208:<br\/>\nvmail:x:5000:<br\/>\n<\/code><\/td><td class=\"col1\"><code>root:x:0:root<br\/>\nbin:x:1:root,bin,daemon<br\/>\ndaemon:x:2:root,bin,daemon<br\/>\nsys:x:3:root,bin,adm<br\/>\nadm:x:4:root,adm,daemon<br\/>\ntty:x:5:<br\/>\ndisk:x:6:root,adm<br\/>\nlp:x:7:lp<br\/>\nmem:x:8:<br\/>\nkmem:x:9:<br\/>\nwheel:x:10:root,BOGUS1,BOGUS2<br\/>\nfloppy:x:11:root<br\/>\nmail:x:12:postfix<br\/>\nnews:x:13:news<br\/>\nuucp:x:14:uucp<br\/>\nman:x:15:<br\/>\ncron:x:16:<br\/>\nconsole:x:17:<br\/>\naudio:x:18:BOGUS1,BOGUS2<br\/>\ncdrom:x:19:<br\/>\ndialout:x:20:<br\/>\nftp:x:21:<br\/>\nsshd:x:22:<br\/>\ntape:x:26:root<br\/>\nvideo:x:27:root<br\/>\nrender:x:28:<br\/>\nmysql:x:60:<br\/>\npostgres:x:70:<br\/>\ndovenull:x:74:<br\/>\ndovecot:x:76:<br\/>\nkvm:x:78:<br\/>\ncdrw:x:80:<br\/>\napache:x:81:BOGUS3<br\/>\nusb:x:85:<br\/>\nnullmail:x:88:<br\/>\ninput:x:97:<br\/>\nusers:x:100:BOGUS1,BOGUS2,BOGUS3<br\/>\nmessagebus:x:101:<br\/>\ncrontab:x:104:<br\/>\nlocate:x:105:<br\/>\nlpadmin:x:106:<br\/>\nntp:x:123:<br\/>\npostfix:x:207:<br\/>\npostdrop:x:208:<br\/>\nsmmsp:x:209:<br\/>\nportage:x:250:<br\/>\nsgx:x:405:<br\/>\nutmp:x:406:<br\/>\nldap:x:439:<br\/>\nBOGUS1:x:1000:<br\/>\nBOGUS2:x:1001:<br\/>\nBOGUS3:x:1002:<br\/>\n<span style='color:#ff7f27; '> vmail:x:5000:<\/span><br\/>\nnogroup:x:65533:<br\/>\nnobody:x:65534:<br\/>\n<\/code><\/td><td class=\"col2\"><code>root:x:0:root<br\/>\nbin:x:1:root,bin,daemon<br\/>\ndaemon:x:2:root,bin,daemon<br\/>\nsys:x:3:root,bin,adm<br\/>\nadm:x:4:root,adm,daemon<br\/>\ntty:x:5:<br\/>\ndisk:x:6:root,adm<br\/>\nlp:x:7:lp<br\/>\nmem:x:8:<br\/>\nkmem:x:9:<br\/>\nwheel:x:10:root,BOGUS1,BOGUS2<br\/>\nfloppy:x:11:root<br\/>\nmail:x:12:postfix<br\/>\nnews:x:13:news<br\/>\nuucp:x:14:uucp<br\/>\nman:x:15:<br\/>\ncron:x:16:<br\/>\nconsole:x:17:<br\/>\naudio:x:18:BOGUS1,BOGUS2<br\/>\ncdrom:x:19:<br\/>\ndialout:x:20:<br\/>\nftp:x:21:<br\/>\nsshd:x:22:<br\/>\ntape:x:26:root<br\/>\nvideo:x:27:root<br\/>\nrender:x:28:<br\/>\nmysql:x:60:<br\/>\npostgres:x:70:<br\/>\ndovenull:x:74:<br\/>\ndovecot:x:76:<br\/>\nkvm:x:78:<br\/>\ncdrw:x:80:<br\/>\napache:x:81:BOGUS3<br\/>\nusb:x:85:<br\/>\nnullmail:x:88:<br\/>\ninput:x:97:<br\/>\nusers:x:100:BOGUS1,BOGUS2,BOGUS3<br\/>\nmessagebus:x:101:<br\/>\ncrontab:x:104:<br\/>\nlocate:x:105:<br\/>\nlpadmin:x:106:<br\/>\nntp:x:123:<br\/>\npostfix:x:207:<br\/>\npostdrop:x:208:<br\/>\nsmmsp:x:209:<br\/>\nportage:x:250:<br\/>\nsgx:x:405:<br\/>\nutmp:x:406:<br\/>\nldap:x:439::<br\/>\nvmail:x:5000:<br\/>\n<span style='color:#ed1c24; '>BOGUS1:x:1000:<br\/>\nBOGUS2:x:1001:<br\/>\nBOGUS3:x:1002:<\/span><br\/>\nnogroup:x:65533:<br\/>\nnobody:x:65534:<br\/><\/code><\/td>\n\t<\/tr>\n<\/table><\/div>\n<!-- EDIT{&quot;target&quot;:&quot;table&quot;,&quot;name&quot;:&quot;&quot;,&quot;hid&quot;:&quot;table&quot;,&quot;secid&quot;:5,&quot;range&quot;:&quot;1967-4935&quot;} -->\n<p>\nNote: here are commands to create the first two table cells entries with multiple lines ready-for-dokuwiki-table format:\n<\/p>\n\n<p>\nColumn 1 (unsorted &#8211; current state):\n<\/p>\n<pre class=\"code\">    cat \/etc\/group | perl -p -e &#039;s\/\\n\/\\\\\\\\ \/&#039;<\/pre>\n\n<p>\nColumn 2 (sorted):\n<\/p>\n<pre class=\"code\">   sort -k 3 -t : -n \/etc\/group | perl -p -e &#039;s\/\\n\/\\\\\\\\ \/&#039;<\/pre>\n\n<p>\n<em>Further Note:<\/em> tr only works on single characters, for example you cannot replace single letter \u201ca\u201d with triple letters \u201cZZZ\u201d.     \n<\/p>\n\n<\/div>\n<!-- EDIT{&quot;target&quot;:&quot;section&quot;,&quot;name&quot;:&quot;\\\/etc\\\/group&quot;,&quot;hid&quot;:&quot;etc_group&quot;,&quot;codeblockOffset&quot;:1,&quot;secid&quot;:4,&quot;range&quot;:&quot;1071-&quot;} --><\/div>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a way to keep your \/etc\/group file &#8220;neat and tidy&#8221; (Gentoo wiki re: Complete Virtual Mail Server) and ensure that additions to \/etc\/group will make numerical sense. Below is from my Dokuwiki page re: sort with redactions (v. 2024\/03\/30 17:20) sort Table of Contents sort Parameters Cookbook Recipes \/etc\/group sort Parameters From man sort: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[19,14,15,18,17],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-gentoo","tag-etc-group-2","tag-gentoo","tag-gentoo-linux","tag-linux","tag-postfix"],"_links":{"self":[{"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=72"}],"version-history":[{"count":6,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=\/wp\/v2\/posts\/72\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salemdata.net\/johnpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}