Saturday, July 1, 2023

How to Change and Move a User's Home Directory in Linux

Linux offers a robust command-line interface (CLI) with powerful tools for managing user accounts. One such command is `usermod`, which we'll focus on today. We will specifically explore how you can use it to change and move a user's home directory, ensuring a seamless transition of files.

Understanding the `usermod` Command

The `usermod` command in Linux is a utility for modifying existing user accounts. It allows you to alter various user details, including home directories, login names, and more.

Steps to Change and Move a User's Home Directory

Here's how to change a user's home directory and move its contents to the new location.

  1. Open the Terminal: This can be done by searching for 'Terminal' in your applications menu or by using the keyboard shortcut `Ctrl + Alt + T`.
  2. Switch to the root user: Type `su -` and enter your root password when prompted. Alternatively, you can prepend `sudo` to the `usermod` command if your user account is in the sudoers file.
  3. Use the `usermod` command: You can change the user's home directory and move the contents to the new directory using the following command:

usermod -m -d /newhome/username username

Here:

  • `usermod` is the command we use to modify an existing user's information.
  • `-m` (or `--move-home`) is an option that moves the contents of the user's current home directory to the new home directory.
  • `-d` (or `--home`) is the option that changes the home directory.
  • `/newhome/username` is the path to the new home directory.
  • `username` is the name of the user whose home directory you want to modify.

Remember:

  • You need to have superuser (root) permissions to use the `usermod` command.
  • Always exercise caution when making changes to system settings.
  • Also, be aware that any absolute path references in scripts or configuration files will not be updated automatically, so these may need to be changed manually.

With this knowledge, you can efficiently change and move a user's home directory in Linux, ensuring data consistency.

Tuesday, November 6, 2018

Upgrade Asus Eee PC Series 1025C with 4GB RAM and SSD 256 GB

I have a netbook Asus Eee PC Series 1025C. It already 5 years old and equipped with Intel® Atom™ N2800 (Dual Core; 1.86GHz) Processor, 2GB RAM and SATA HDD 320 GB. The challenge is I want to upgrade this netbook so it can be faster to run.

The limitations are processor is support only 32 bit OS and maximum RAM usable is 3 GB only. So, I just changed the DDR3 RAM from 2 GB to 4GB and HDD to SSD. I was using Ubuntu Linux before, but in this time I tried to install Windows 7 32 bit and Microsoft Office 2016 with original license.


I failed when tried to install Windows 10 bit, it won't work because problem with display driver for Asus Eeee PC 2015C not supported by Asus or Intel. They don't give update for their display driver to compatible with Windows 10.

The SSD is Silicon Power A56 256 GB. The read write result test using winsat command shows that the SSD performance increased significantly than using HDD.


Friday, October 19, 2018

How to Set Quota on CLoudLinux 7.5 kvm Image With XFS

I just installed CloudLinux 7.5 kvm images, downloaded from CloudLinux website, then failed to update Quota on the WHM. They already set it with XFS file system.
Updating Quota Files......
quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.

Then I did this.

Check /etc/fstab makes sure that the quota is enabled on the partition
UUID=xxx-xxx / xfs     defaults,uquota 0 0
Check the quota option for XFS filesystem.

# mount| grep ' / '
You will see something like this.
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,noquota)
If you see the "noquota" option, then you need to go to next step.

Edit /etc/default/grub add rootflags=uquota
GRUB_CMDLINE_LINUX="crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet rootflags=uquota"
Reconfig grub
# grub2-mkconfig -o /boot/grub2/grub.cfg
# reboot
After the server started.
# mount| grep ' / '
Then the XFS will change like this.
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,usrquota)
Fix WHM quota
# /scripts/fixquotas
# reboot