Create Apache User with a specified UID with home directory in in /var/www

@Inderpreet @mmumshad

I was suppose to create a User ‘rose’ with home directory in /var/www and UID 1108.

I completed the task SUCCESSFULLY but need to CLARIFY DOUBTS.

I used following command and output came "cannot create directory"
[root@stapp02 steve]# useradd -m -d /var/www/rose -u 1108 rose
useradd: cannot create directory /var/www/rose

I retried to create user without -u argument and output came "user ‘rose’ already exist"
[root@stapp02 steve]# useradd -m -d /var/www/rose rose
useradd: user ‘rose’ already exists

I changed directory to /var and use ls and couldn’t find www
[root@stapp02 steve]# cd /var/www
bash: cd: /var/www: No such file or directory
[root@stapp02 steve]# cd /var
[root@stapp02 var]# ls
adm db games kerberos local log nis preserve spool yp
cache empty gopher lib lock mail opt run tmp
[root@stapp02 var]# cd www
bash: cd: www: No such file or directory

Confirmed if user ‘rose’ was created with desired UID:
[root@stapp02 var]# id -u rose
1108.

QUESTION: When there is no www directory in /var, how can I create /var/www/rose? Was the home directory for ‘rose’ ever got created that I couldn’t find? How the task completion was a success if home directory was never created?

@arjitn
You can check using command cat /etc/passwd | grep rose , it will show home directory of rose

1 Like

Thanks. Will give it a shot next time. Right now, task is successfully completed.

1 Like