LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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-10-2012, 02:07 PM   #1
dayo_centos
LQ Newbie
 
Registered: Mar 2011
Posts: 5
Blog Entries: 1

Rep: Reputation: 0
Changing username and home/user directory


I have a Linux based application but i wanted to change the home /user directory from dayo@localhost to abc@localhost ALSO i wanted to change the username too.

How do i do this .
Thanks
 
Old 09-10-2012, 02:32 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
Hi, welcome to LQ.

As root:
Code:
usermod -d /home/abc -m -l abc dayo
Type "man usermod" to know more.

PS You don't even have to create the /home/abc directory or to move the files from /home/dayo to /home/abc, "usermod" will do it for you.

Last edited by Didier Spaier; 09-10-2012 at 02:46 PM. Reason: PS added
 
Old 09-11-2012, 04:20 AM   #3
dayo_centos
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Original Poster
Blog Entries: 1

Rep: Reputation: 0
Thanks Didier, however, i could not get it done anyway. When i applied the code at [root@localhost /]# usermod -d /home/abc -m -l abc dayo

THE RESPONSE IS "bash: usermod: command not found"

Do i have to edit the names in etc/passwd , etc/group and etc/shadow ,etc/gshadow. or what?

I just want to have a change of my name from [dayo@localhost~]$ to [abc@localhost~]$.
and also change my login username from dayo to abc
 
Old 09-11-2012, 05:38 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
AFAIK the "usermod" command is available for CentOS. Check the CentOS documentation or make a Google search for "centos usermod"
 
Old 09-11-2012, 05:45 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Certainly on Centos6 its /usr/sbin/usermod & probably the same in v5.
http://www.linuxtopia.org/online_boo...users-cmd-line
http://www.linuxtopia.org/online_boo...ers-tools.html

Definitely need to be root.
Possibly your root user's $PATH does not contain that dir?
 
Old 09-11-2012, 06:26 AM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
Or maybe you became root with "su" instead of "su -"?

In any case typing the full path of the command as root, i.e.
Code:
/usr/sbin/usermod -d /home/abc -m -l abc dayo
should work.

Last edited by Didier Spaier; 09-11-2012 at 06:27 AM.
 
  


Reply



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
I made a mistake changing my /home/username/pubIic_html/ ownership to username:user Sionek2u Linux - Newbie 5 06-20-2012 10:30 AM
changing home directory permission in user management after user created in suse(KDE) hamedhsn Linux - Security 4 04-06-2011 09:18 PM
Fedora 12 SELinux context not updated when changing a user's home directory RichyAD Fedora 4 02-21-2010 05:10 PM
Constrain user to /home/username directory General Linux - Security 3 04-05-2007 01:52 AM
Changing user's home directory? HOW barton Debian 10 04-04-2005 02:27 AM

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

All times are GMT -5. The time now is 02:57 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