Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Colin Stodd
Colin Stodd
3,160 Points

Cannot Delete User Account

I'm doing the Console Foundations Drive, and we created a user account, however, I am unable to delete that account. I searched the web and found something that said to do: sudo userdel 'username' then delete the files by doing: sudo rm -r /home/username but Its not working. The username is still there and able to be logged into. Thanks in advance for your help.

2 Answers

James Barnett
James Barnett
39,199 Points

Not sure exactly what your issue is, I just tried this in the Treehouse console.

sudo useradd test
sudo userdel test

As an aside you can check if the test account is on the system by using sudo grep test /etc/passwd.

Colin Stodd
Colin Stodd
3,160 Points

Sorry to be getting back to you so late James (was out of town). But I wasn't using the "Treehouse Console" I was using the one in Ubuntu 13.10. I created a user account like they do in the Console Dive, but I am not able to delete the account that I created..

James Barnett
James Barnett
39,199 Points

Well those commands should certainly work on ubuntu.

James Barnett
James Barnett
39,199 Points

If the user is currently logged in then you can force the deletion using the -f switch.

sudo userdel -f test

That should work

Idk about Colin, but when I run userdel it says "user Mike the Frog does not exist". Then I take a peek at the login to Linux screen and Mike the Frog is sitting right there. Userdel doesn't seem to be working for me either and I"m not sure how to delete him.