LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 03: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, 03:32 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2 on Lenovo Thinkpad W520
Posts: 7,763

Rep: Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691
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 03:46 PM. Reason: PS added
 
Old 09-11-2012, 05:20 AM   #3
dayo_centos
LQ Newbie
 
Registered: Mar 2011
Posts: 5
Blog Entries: 1

Original Poster
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, 06:38 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2 on Lenovo Thinkpad W520
Posts: 7,763

Rep: Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691
AFAIK the "usermod" command is available for CentOS. Check the CentOS documentation or make a Google search for "centos usermod"
 
Old 09-11-2012, 06:45 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 07:26 AM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2 on Lenovo Thinkpad W520
Posts: 7,763

Rep: Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691Reputation: 2691
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 07:27 AM.
 
  


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

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

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