3

I have a Ubuntu root filesystem (from another system) partition mounted inside my current system (also Ubuntu).

I would like to remove a user from that system. Is it possible to do that, for example, using chroot into that mount point and then running the userdel command?

2 Answers 2

4

Sure, you can use chroot.

mount /dev/sdb1 /mnt
chroot /mnt
deluser <username>
exit
umount /mnt

Assuming /dev/sdb1 is the partition where your secondary system was installed: mount it, and chroot its root directory.

1

Is it possible to do that, for example, using chroot into that mount point and then running the userdel command?

SYN answered how to do it with userdel while I was typing.

Without using userdel would take just a few steps:

  • Find the UID of the user with id -u {username} and check if there are any temp files belonging to that user with

    find /var /tmp -uid n
    
  • Delete the user from ...

    /etc/shadow
    /etc/passwd
    
  • Not really needed but you could also remove ...

    /etc/group
    /etc/login.defs 
    

man userdel shows these files as related to userdel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .