Results 1 to 5 of 5

Thread: I can't remove an erased user's directory (U 12.04)

  1. #1
    Join Date
    Dec 2009
    Beans
    396

    I can't remove an erased user's directory (U 12.04)

    I had created "ubuntuuser", now it's gone (I erased the user) but his folder remains, and I can't remove it. rmdir ubuntuuser doesn't work (Permission denied)

    sudo ... ( Directory not empty)

    sudo rmdir ubuntuuser --ignore-fail-on-non-empty (nothing happens, no message but directory is not removed).

    If I right-click on the folder (Nautilus), now the owner is 1003 - user #1003 (?)

    Group: 1004 (?)

    And the Folder access options are disabled.

    So? How can I erase that folder?

  2. #2
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: I can't remove an erased user's directory (U 12.04)

    The safest way of removing a user's home directory is via an option on the "deluser" command. For the example you gave, it would be:
    Code:
    deluser --remove-home ubuntuuser
    There is another way, which requires special care, because it could result in accidental loss of data.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  3. #3
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,820
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: I can't remove an erased user's directory (U 12.04)

    You'll have to delete all contents of the directory before you can delete the directory itself. The quick way is
    Code:
    sudo rm -r /home/ubuntuuser
    Be careful, one additional space can wipe your entire system.

    PS: The save way would be lisati's suggestion, but I don't know whether that still works after you already deleted the user.

  4. #4
    Join Date
    Dec 2009
    Beans
    396

    Re: I can't remove an erased user's directory (U 12.04)

    Quote Originally Posted by lisati View Post
    The safest way of removing a user's home directory is via an option on the "deluser" command. For the example you gave, it would be:
    Code:
    deluser --remove-home ubuntuuser
    There is another way, which requires special care, because it could result in accidental loss of data.
    The problem is that the user ubuntuuser doesn't exist anymore, so I get this message: The user `ubuntuuser' does not exist.

  5. #5
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: I can't remove an erased user's directory (U 12.04)

    Quote Originally Posted by rva1945 View Post
    The problem is that the user ubuntuuser doesn't exist anymore, so I get this message: The user `ubuntuuser' does not exist.
    The other way I had in mind is very similar to Impavidus's suggestion. Care is needed, because a simple typo can cause accidental loss of data.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •