LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 08: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, 08:42 PM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Back to Debian, and only Debian.
Posts: 1,142
Blog Entries: 7

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
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, 09:28 AM   #3
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,675
Blog Entries: 10

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
In LinuxMint, look for Users and Groups in the menu.
 
1 members found this post helpful.
Old 09-18-2015, 08: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:	12
Size:	92.4 KB
ID:	19613  

Last edited by green ice; 09-18-2015 at 08:30 PM.
 
Old 09-19-2015, 12:18 AM   #5
robertdaleweir
Member
 
Registered: Jul 2006
Location: Canada
Distribution: Fedora
Posts: 70

Rep: Reputation: 8
[/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-19-2015 at 12:30 AM.
 
1 members found this post helpful.
Old 09-20-2015, 05: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:	12
Size:	248.0 KB
ID:	19631  
 
Old 09-20-2015, 05: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 05:16 PM.
 
Old 09-21-2015, 06:26 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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 12:10 PM
How to edit PAM DB of VSFTPD (..add user, delete user, change user password ) jsaravana87 Linux - Server 1 10-02-2012 09:49 AM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 02:08 AM
Prompt w/ current dir and user Jair Slackware 2 03-15-2004 07:16 PM
Adding default Dir to New user Accounts Joshsawyer77 Linux - General 2 01-25-2003 03:38 PM


All times are GMT -5. The time now is 04:48 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration