Create a user with a specific ID & Home Directory KodeKloud Engineer Task

Ticker

6/recent/ticker-posts

Create a user with a specific ID & Home Directory KodeKloud Engineer Task

Question :  For security reasons the xFusionCorp Industries security team has decided to use custom Apache users for each web application hosted, rather than its default user. This will be theApache user, so it shouldn't use the default home directory. Create the user as per requirements given below:

a. Create a user named yousuf on the App server 1 in Stratos Datacenter.

b. Set UID to 1128 and its home directory to /var/www/yousuf.

 Please Note :-  Perform the below commands based on your question server,  user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍

Solution:  

1. Login on app server as per the task &  Switch to root user 

thor@jump_host /$ ssh tony@stapp01

The authenticity of host 'stapp01 (172.16.238.10)' can't be established.

ECDSA key fingerprint is SHA256:G4hE4jjizKnDulV/G1nuw2Q7Jd8RXdccXG/HR7mGxe4.

ECDSA key fingerprint is MD5:79:93:6b:e2:f5:bc:47:92:f0:f2:5d:73:46:ca:6b:f0.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts.

tony@stapp01's password:

[tony@stapp01 ~]$ sudo su -

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for tony:

[root@stapp01 ~]#

2. Run the Below command to create a new user yousuf with UID

      ( Note -  check user name & ID in your task)

[root@stapp01 ~]# useradd -u 1128 yousuf

[root@stapp01 ~]#

[root@stapp01 ~]# id yousuf

uid=1128(yousuf) gid=1128(yousuf) groups=1128(yousuf)

[root@stapp01 ~]#

[root@stapp01 ~]# cat /etc/passwd |grep yousuf

yousuf:x:1128:1128::/home/yousuf:/bin/bash

[root@stapp01 ~]#

3.  Post user creation run Below command to change user home directory.

     Refer mine youtube video for more details  ( check home directory in your task)

[root@stapp01 ~]# usermod -d /var/www/yousuf -m yousuf

[root@stapp01 ~]#

[root@stapp01 ~]# cat /etc/passwd |grep yousuf

yousuf:x:1128:1128::/var/www/yousuf:/bin/bash

[root@stapp01 ~]#

4. Click on Finish & Confirm to complete the task successfully

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 

please go through and share your comments. Like and share the knowledge













Post a Comment

2 Comments

  1. asking for password after the SSH command.what to do now?

    ReplyDelete
    Replies
    1. For ssh particular user and server login credentials refer in the link https://www.nbtechsupport.co.in/2022/08/kodekloud-servers-login-credentials.html

      Delete

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user