{
  "id": "CB-UBU-AUTH-021",
  "standard": "ubuntu",
  "version": "0.1.1",
  "url": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-AUTH-021",
  "json": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-AUTH-021.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-AUTH-021.yml",
  "profiles_effective": [
    "server-hardened",
    "desktop-hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-UBU-AUTH-021",
    "title": "Do not list nologin as a valid shell",
    "finding": {
      "title": "nologin is declared as a valid login shell",
      "description": "Programs that only allow accounts with a valid shell (FTP servers, chsh) treat no-login accounts as normal ones."
    },
    "status": "active",
    "profiles": [
      "server-hardened",
      "desktop-hardened"
    ],
    "risk": {
      "severity": "low"
    },
    "assessment": "automated",
    "tags": [
      "accounts",
      "shells"
    ],
    "description": "`/etc/shells` lists the valid login shells. Some programs, like `chsh` and FTP servers, use it\nto decide whether an account may log in. `nologin` exists precisely to refuse logins and must\nnot appear there.\n",
    "rationale": "Listing `nologin` makes service accounts look like regular users to programs that rely on\n`/etc/shells`, which can open them to FTP logins or let users switch to it and back.\n",
    "impact": "None known. Ubuntu does not list it by default.\n",
    "audit": {
      "manual": "Run `grep nologin /etc/shells`. There must be no match.\n",
      "checks": [
        {
          "id": "shells",
          "engine": "file-content",
          "spec": {
            "path": "/etc/shells",
            "pattern": "nologin",
            "expect": "no_match"
          }
        }
      ]
    },
    "remediation": {
      "manual": "Remove the `nologin` lines from `/etc/shells`.\n",
      "effects": {
        "restart": "none",
        "disruption": "none",
        "lockout_risk": false
      },
      "scripts": [
        {
          "id": "remove",
          "engine": "shell",
          "content": "cb_backup /etc/shells\nsed -i '/nologin/d' /etc/shells\n"
        }
      ]
    },
    "references": [
      {
        "title": "shells(5), Ubuntu manual pages",
        "url": "https://manpages.ubuntu.com/manpages/noble/man5/shells.5.html",
        "publisher": "Canonical",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      }
    ],
    "mappings": [
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "CM-6",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1078.003"
      }
    ],
    "authors": [
      {
        "name": "Alice",
        "github": "Sn0wAlice"
      }
    ],
    "verified": [
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "20.04"
        ],
        "environment": "Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic",
        "notes": "Passes on a fresh install; profile server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "22.04"
        ],
        "environment": "Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic",
        "notes": "Passes on a fresh install; profile server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "24.04"
        ],
        "environment": "Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic",
        "notes": "Passes on a fresh install; profile server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "26.04"
        ],
        "environment": "Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic",
        "notes": "Passes on a fresh install; profile server-hardened."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}