Change the home directory by editing /etc/passwd
Alternatively you can also edit the /etc/passwd to change the home directory. But you should be careful not to edit anything else. Before editing this file it is always better to create the new home directory and assign proper permissions and ownership to it. Execute the following commands.
Open the /etc/passwd file using a text editor and locate the line containing the required username it should look something like this
change it to
Save the file.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory
Open the /etc/passwd file using a text editor and locate the line containing the required username it should look something like this
username:x:500:500::/home/username:/bin/bash
change it to
username:x:500:500::/home/new_home_directory:/bin/bash
Save the file.
Finally copy all the old content to the new home directory
cp -f /home/username/* /home/new_home_dir/
Tidak ada komentar:
Posting Komentar