Create a user without home directory

hi there,

I was asked to create user without home directory and set uid but task yet failed, please clarify on this

i ran below command

useradd -M -u 1451 ravi
then created /var/www/ravi directory and given uid value as chmod 1451 /var/www/ravi

please help what went wrong here

I think uid 1451 not relate to chmod 1451.

You can try with below command
useradd -M ravi -u 1451

Also, chmod 1451 /var/www/ravi will not work as Chmod is used for to change the permission of file or directory.
chmod 1451 is not a valid command.
After creating the user, you need to change the ownership of /var/www/ravi directory using
chown -R ravi:ravi /var/www/ravi
These steps you need to perform according to your question.

As a good practice, before submitting the answer please verify that your solution is correctly working or not.

Akshay, thanks for the response, I managed to complete the task earlier.