LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-16-2015, 07:32 PM   #1
green ice
Member
 
Registered: Jun 2015
Posts: 152

Rep: Reputation: Disabled
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.
 
Old 09-16-2015, 07:42 PM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
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.
 
1 members found this post helpful.
Old 09-17-2015, 08:28 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
In LinuxMint, look for Users and Groups in the menu.
 
1 members found this post helpful.
Old 09-18-2015, 07:24 PM   #4
green ice
Member
 
Registered: Jun 2015
Posts: 152

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
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.
Attached Thumbnails
Click image for larger version

Name:	user and groups page.png
Views:	25
Size:	92.4 KB
ID:	19613  

Last edited by green ice; 09-18-2015 at 07:30 PM.
 
Old 09-18-2015, 11:18 PM   #5
robertdaleweir
Member
 
Registered: Jul 2006
Location: Canada
Distribution: Fedora
Posts: 93

Rep: Reputation: 11
[/COLOR]
Quote:
Originally Posted by green ice View Post
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

Last edited by robertdaleweir; 09-18-2015 at 11:30 PM.
 
1 members found this post helpful.
Old 09-20-2015, 04:07 PM   #6
green ice
Member
 
Registered: Jun 2015
Posts: 152

Original Poster
Rep: Reputation: Disabled
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.
Attached Thumbnails
Click image for larger version

Name:	ANSWER USERDEL COMMAND.jpg
Views:	20
Size:	248.0 KB
ID:	19631  
 
Old 09-20-2015, 04:11 PM   #7
green ice
Member
 
Registered: Jun 2015
Posts: 152

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by robertdaleweir View Post

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.

Last edited by green ice; 09-20-2015 at 04:16 PM.
 
Old 09-21-2015, 05:26 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Well, if you'd actually told sudo to fire the userdel cmd ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the 'user.home' and 'user.dir' with a Linux command? thomas2004ch Linux - Software 5 03-31-2014 11:10 AM
How to edit PAM DB of VSFTPD (..add user, delete user, change user password ) jsaravana87 Linux - Server 1 10-02-2012 08:49 AM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
Prompt w/ current dir and user Jair Slackware 2 03-15-2004 06:16 PM
Adding default Dir to New user Accounts Joshsawyer77 Linux - General 2 01-25-2003 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration