Wednesday, August 21, 2024

Debian - Reset Any User Password


Procedure:

1. Connect file system to another Debian machine

2. Mount file system and verify:
  1. lsblk (find sdx1 device)
  2. sudo mkdir /mnt/microsd
  3. sudo mount /dev/sdx1 /mnt/microsd
  4. ls /mnt/microsd
3. Open shadow file in nano
  1. sudo nano /mnt/microsd/etc/shadow
4. The file is /etc/shadow, there will be lines like:

user:asdfasdfasdf$$$$asdfasdfasdfsadfasdf::17178:0:98899:7:::

5. You must remove the fist field between : and :

user:THIS_IS_WHAT_WAS_REMOVED:17178:0:98899:7:::

6. Unmount the file system from the rescue machine.

  1. umount /mnt/microsd

7. Reconnect to target OS via serial.

8. Boot and login with root.

9. Change password with passwd.





๐Ÿ‘ฝ

Enterprise Infrastructure & Security Support

Need assistance hardening your network perimeter, orchestrating Hyper-V clusters, deploying SentinelOne EDR, or configuring multi-tenant Microsoft 365 environments? Pat's IT Solutions, LLC provides enterprise-grade co-managed IT, 24/7/365 monitoring, and weekend SLAs for commercial organizations across New Jersey.

Schedule an Infrastructure Audit → Phone: Reveal Direct Line

No comments: