Results 1 to 6 of 6

Thread: Manual Deletion of user account home file

  1. #1
    Join Date
    Apr 2013
    Beans
    9

    Manual Deletion of user account home file

    Hi again all! Well since I'm very new at this I've made a blunder. I added then deleted a account to my server, but of course the /home directory for that user is still listed. How do I go about removing that /home directory for that deleted user.

    Thank you!
    Last edited by Gannas; April 9th, 2013 at 06:37 PM.

  2. #2
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Manual Deletion of user account home file

    Use 'sudo delluser --remove-home username', or even 'sudo deluser --remove-all-files username'.

  3. #3
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Manual Deletion of user account home file

    To remove the directory you simply do this at the terminal prompt
    Code:
    sudo rm -f /home/<directory_name_you_are_deleting>
    This can be dangerous if you select the wrong directory to delete so be careful. To see all the directories in /home you can use this command from the terminal
    Code:
    ls -l /home
    -BAB1

  4. #4
    Join Date
    Apr 2013
    Beans
    9

    Re: Manual Deletion of user account home file

    Thank you for the response gang! But it doesn't seem to have worked. I think I should also say this is a fresh install of 12.04 and I'm using a ssh. Here's what I got when I put those commands.

    gannas1@HS1920ESGW:~$ ls -l /home
    total 12
    drwxr-xr-x 2 eric eric 4096 Apr 8 14:41 eric
    drwxr-xr-x 4 gannas1 gannas1 4096 Apr 8 15:15 gannas1
    drwxr-xr-x 2 eric eric 4096 Apr 8 14:40 username
    gannas1@HS1920ESGW:~$ sudo deluser --remove-home username
    [sudo] password for gannas1:
    /usr/sbin/deluser: The user `username' does not exist.
    gannas1@HS1920ESGW:~$ sudo deluser --remove-all-files username
    /usr/sbin/deluser: The user `username' does not exist.
    gannas1@HS1920ESGW:~$ sudo re -f /home/username
    sudo: re: command not found
    gannas1@HS1920ESGW:~$


    Yes, since I'm new to Ubuntu, I was playing around when I made the user "username". So what should I do now? Thank you again for the help.
    Last edited by Gannas; April 9th, 2013 at 05:55 PM.

  5. #5
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    3,262
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Manual Deletion of user account home file

    Clearly, user "username" doesn't exist. His home directory, /home/username, still exists but is owned by user eric (at least, that's the name belonging to it. There might be a mix-up of usernames and usedIDs) But if you're positive you don't want to keep eny files in /home/username, try
    Code:
    sudo rm -rf /home/username
    (You used sudo re -f. This gave your error)
    (Careful: sudo rm-rf is a very dangerous command. It can easely destroy your system)

  6. #6
    Join Date
    Apr 2013
    Beans
    9

    Re: Manual Deletion of user account home file

    Thank you! That did the trick. Here's the proof!

    gannas1@HS1920ESGW:~$ sudo rm -rf /home/username
    [sudo] password for gannas1:
    gannas1@HS1920ESGW:~$ ls -l /home
    total 8
    drwxr-xr-x 2 eric eric 4096 Apr 8 14:41 eric
    drwxr-xr-x 4 gannas1 gannas1 4096 Apr 8 15:15 gannas1
    gannas1@HS1920ESGW:~$

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
  •