# Boot into rescue mode with disabled root account

**URL:** https://discourse.nixos.org/t/boot-into-rescue-mode-with-disabled-root-account/13801
**Category:** Guides
**Created:** [June 25, 2021, 6:55pm UTC](https://discourse.nixos.org/t/boot-into-rescue-mode-with-disabled-root-account/13801 "2021-06-25T18:55:20Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![bjornfor](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@bjornfor](https://discourse.nixos.org/u/bjornfor)
#### Post date: [June 25, 2021, 6:55pm UTC](https://discourse.nixos.org/t/boot-into-rescue-mode-with-disabled-root-account/13801/1 "2021-06-25T18:55:20Z")

</div>

If you need to get a root shell on a NixOS[1] machine and the root account is disabled/locked (and/or you’ve forgotten all your passwords), here’s how to do it (without booting a live ISO).

When the machine boots, interrupt the bootloader and add this to the bootloader command-line:

```auto
[...] rescue systemd.setenv=SYSTEMD_SULOGIN_FORCE=1

```

(Without SYSTEMD\_SULOGIN\_FORCE=1 you will not be able to get a shell if the root account is disabled/locked.)

Ref. [sulogin-shell: Use force if SYSTEMD\_SULOGIN\_FORCE set · systemd/systemd@33eb44f · GitHub](https://github.com/systemd/systemd/commit/33eb44fe4a8d7971b5614bc4c2d90f8d91cce66c)

[1]: Or any GNU/Linux distro really.

---

_[View the full topic](https://discourse.nixos.org/t/boot-into-rescue-mode-with-disabled-root-account/13801)._
