Reputation: 385
I am creating folder/file in linux using jdk 1.4 (mkdir). I am running this code from my application using test user(limited permission). But the folder/file is creating with root permission. I need to delete these files and folders manually at later time. When i try to delete the folder/file i got access denied. The JDK is installed in root.
How can i create the folder/file with different user permission (non root) in java 1.4?
Please help me. Thanks in advance.
Upvotes: 0
Views: 1399
Reputation: 864
Are you running your program as root user? in that case it will create files also as root user, so either run your program also as test user, or use sudo -u <username> mkdir <dirname>
.
Upvotes: 0
Reputation: 16060
Your files will be created with the owner of whatever your VM runs as. If you want to run as a different user, su - <userid>
is your friend.
You can eg. use the --command
param to mkdir
your directory.
Cheers,
Upvotes: 1