How to Change Home Directory of a User in AlmaLinux - YouTube Script

This is a YouTube script for a tutorial on how to change the home directory of a user in AlmaLinux.

Introduction (30 seconds)

Hello everyone. Welcome to my channel! Today, I will show you how to change the home directory of a user in AlmaLinux.

Changing the Home Directory

To change the home directory of a user, you can use the usermod command followed by the -d option. For example, we want to change “john”’s home directory.

Let’s check the current home directory of “john” first:

getent passwd john

The output will look something like this:

john:x:1001:1001::/home/john:/bin/bash

Now, let’s change the home directory of “john” to /home/john_doe:

sudo usermod -d /home/john_doe john
getent passwd john

This command changed the home directory of “john” to /home/john_doe.

Now we want to reverse this change and set the home directory back to /home/john:

sudo usermod -d /home/john john
getent passwd john

This command changed the home directory of “john” back to /home/john.

Conclusion (30 seconds)

If you found this tutorial helpful, please like and subscribe for more Linux administration videos. Drop any questions in the comments below!

Thanks for watching, and happy Linux administrating!

Optional Thumbnail Text Ideas

  • How to Change Home Directory of a User in AlmaLinux