LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing username and home/user directory (https://www.linuxquestions.org/questions/linux-newbie-8/changing-username-and-home-user-directory-4175426580/)

dayo_centos 09-10-2012 02:07 PM

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

Didier Spaier 09-10-2012 02:32 PM

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.

dayo_centos 09-11-2012 04:20 AM

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

Didier Spaier 09-11-2012 05:38 AM

AFAIK the "usermod" command is available for CentOS. Check the CentOS documentation or make a Google search for "centos usermod"

chrism01 09-11-2012 05:45 AM

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?

Didier Spaier 09-11-2012 06:26 AM

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.


All times are GMT -5. The time now is 02:37 AM.