LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Delete current user and dir, adding new user (https://www.linuxquestions.org/questions/linux-newbie-8/delete-current-user-and-dir-adding-new-user-4175553717/)

green ice 09-16-2015 07:32 PM

Delete current user and dir, adding new user
 
I would like to create a new normal user and delete the current normal user along with its files.

This operation I do as root I know.

I think the code would be:
sudo useradd [newusername]

sudo userdel -r [currentusername]

Is this the correct position for the -r? I assume options like -r go after the command userdel but before the username?

Any help appreciated.

goumba 09-16-2015 07:42 PM

Yes, usually, it is options before the arguments. Many commands just don't care. Others do. Play it safe and do it just as you have it here.

Habitual 09-17-2015 08:28 AM

In LinuxMint, look for Users and Groups in the menu.

green ice 09-18-2015 07:24 PM

1 Attachment(s)
Quote:

Originally Posted by Habitual (Post 5421686)
In LinuxMint, look for Users and Groups in the menu.

I guess you are implying I can do this operation through the graphical interface, but I don't see any way to delete my main and only username (except for root).

screenshot attached

I want to delete this user and add a new one. I assume the new username will belong to all the same groups, since I did nothing to groups configuration.

If I can't delete the user in the graphical interface, I am back to using the terminal.

robertdaleweir 09-18-2015 11:18 PM

[/COLOR]
Quote:

Originally Posted by green ice (Post 5422491)
I guess you are implying I can do this operation through the graphical interface, but I don't see any way to delete my main and only username (except for root).

screenshot attached

I want to delete this user and add a new one. I assume the new username will belong to all the same groups, since I did nothing to groups configuration.

If I can't delete the user in the graphical interface, I am back to using the terminal.

Hi green ice
Add your new user using the add+ item. Then highlight the old one and use delete to erase it. Not sure about the files but they can be removed through File Manager.
Robert
Robert

green ice 09-20-2015 04:07 PM

1 Attachment(s)
I just tried the command through the terminal and got the following response. since the response is to the username I tried to delete, I guess it means I was unsuccessful.

The response gives me usage code, but none of them seem to contradict or help what I wanted to do.

If this does not work, I will try delete both user and files through the graphical interface.

screenshot attached.

green ice 09-20-2015 04:11 PM

Quote:

Originally Posted by robertdaleweir (Post 5422569)

Hi green ice
Add your new user using the add+ item. Then highlight the old one and use delete to erase it. Not sure about the files but they can be removed through File Manager.

Robert

The delete option is grayed out for my first username, so I cannot delete it. There is an option to delete the 2nd username I just added.

The first username is the one I created when I installed Linux Mint. It is administrative. This may be the reason it cannot be deleted.

I may have to remove administrative status from that username --sonylinux--before I can delete it. Nope, I just deleted admin from the groups the first username has but still cannot delete the username.

chrism01 09-21-2015 05:26 AM

Well, if you'd actually told sudo to fire the userdel cmd ... ;)


All times are GMT -5. The time now is 04:00 PM.