Operating System - HP-UX
1753905 Members
9479 Online
108810 Solutions
New Discussion юеВ

Re: how to rename my home directory

 
rajesh73
Super Advisor

how to rename my home directory

how to rename my home directory

example

/home/rajesh

i want to change /home/rajeshd

kindly help rajesh account is normal user
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: how to rename my home directory

You need to do two things:
1) Rename your directory with: mv /home/rajesh /home/rajeshd
2) Update /etc/passwd to point to the new one.

usermod(1m) should probably do the latter, not sure about the former. You can also use vipw(1m) to edit /etc/passwd.

>rajesh account is normal user

Typically the user name matches the home directory, did you want to change that too?
EmmanuelK2
Advisor

Re: how to rename my home directory

Hello rajesh,
The usermod command can be used to modify user specific settings. the "-d" option is used to set the users home directory.
The command is below:
"usermod -d /home/rajeshd rajesh"

Regards
Emmanuel
Edwin J.C. Cleymans
New Member

Re: how to rename my home directory

As a short term solution, ask the owner of the /home directory to make a "hard link" e.g. :
ln /home/rajesh /home/rajeshd

As of that moment, you can use both names, as they will be translated to the same inode-number. Over time, the link that becomes less used can then be removed, again by the owner of the /home directory.

the usermod command is probably the best method, but this is typically a job for the system administrator ...

Kind regards

Edwin
Dennis Handly
Acclaimed Contributor

Re: how to rename my home directory

>Edwin: ask the owner of the /home directory to make a "hard link" e.g.:
ln /home/rajesh /home/rajeshd

That's a good trick since only root can do that and not with ln(1). A symlink would work.

>but this is typically a job for the system administrator

Only the sysadmin can do these things.