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"
[[email protected] 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"
[[email protected] 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
[[email protected] steve]# cd /var/www
bash: cd: /var/www: No such file or directory
[[email protected] steve]# cd /var
[[email protected] var]# ls
adm db games kerberos local log nis preserve spool yp
cache empty gopher lib lock mail opt run tmp
[[email protected] var]# cd www
bash: cd: www: No such file or directory

Confirmed if user ‘rose’ was created with desired UID:
[[email protected] var]# id -u rose

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?

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