How to create a directory inside root as different user

Hi All,

I have directory under /opt/test.
The ownership of the test directory is root:root.

I have login to the server as test user.
I need to have some script to create a directory inside /opt/test.
This script will be called as test user.

When I try to execute this script, I am getting error as Permission denied.

How I can solve this great issue.

Regards,
Kalai

The ownership? what about the permissions?

---------- Post updated at 16:14 ---------- Previous update was at 16:13 ----------

of /opt/test (of couse)

vbe is correct to ask for ownership and permissions on /opt/test.

Just a little background, any time you create a new file or directory UNIX/Linux sets the ownership to the user id and group id of the user creating the file. The permissions that vbe mentions are if you can read, write, or execute the file. These are set to a default value that is part of your environment.

Here is a few commands that you might be interested in:

chown - changes the ownership of a file for user id.
chgrp - changes the ownership of a file for group id.

chmod - permission of files.

umask - default permissions for newly created files.

Hope these helps, let me know if I have helped.

Thanks for your information.
The ownership of the test directory is root:root.

I will be executing the script as a test user.At this senario i need to create a directory or file inside /opt/test/

post the output from the command

 
ls -l /opt/test