In this post, I am going to show you how to add a Linux User Without Home Directory.
Linux User Without Home Kodekloud Engineer – Task Details:
The system admins team of xFusionCorp Industries has set up a new tool on all app servers, as they have a requirement to create a service user account that will be used by that tool. They are finished with all apps except for App Server 1 in Stratos Datacenter.
Create a user named john in App Server 1 without a home directory.
Important Note: Perform the below commands based on your question. The server, user name & other details might differ. So please read the task carefully before executing it.
Solution:- To create a Linux user without home directory follow the steps below:
Step 1: To start with, login to App server 1. Make sure you log in to the app server mentioned in your question.
$ ssh tony@stapp01
Enter the password provided to you using the documentation for authentication.
Step 2: Use the following command to create a user without a home directory.
$ sudo useradd -M john
Step 3: To check if the user is added without a home directory. Enter the below command and check.
$ cat /etc/passwd | grep john
$ ls /home/