Title: Create folder as Apache with user add Centos
Tags: centos;mount;apache-httpd;php
Question: I have a windows drive that's mounted onto my Linux server. PHP and Apache web server needs to create folders on the windows drive with (mkdir) but I get permission error.
I have mounted my windows network shared drive as apache:root. I want to be able to login as the user apache and create a folder.
Is there a command where I can issue
mkdir -asapacheuser folder? when I'm logged in as any user on my linux box to see if the mounted drive lets me create folders?
My webserver user is apache which is httpd.

Here is the accepted answer: You should be able to use
install -o apache -d /my/test/directory
but as usual, you'll need to be root to create files/dirs with somebody else's ownership. (At that point, you could as easily sudo -u apache /bin/bash to gain a shell as the apache user.
Comment for this answer: this was really helpful in figuring out if apache user can create directory on the mounted windows drive. i figured out it was my code that was causing the issue because it was a older source that was crating directories on the mounted windows drive following windows style directory navigation.


{'source': 'StackExchangeDataset', 'subset': 'unix.stackexchange.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:01/12/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<centos><mount><apache-httpd><php>', 'Title': 'Create folder as Apache with user add Centos', 'ViewCount': 875, 'id': 178747, 'user_AboutMe': '<p>Big fan of Arduio, Arduino UNO, Arduino YUN, RaspberryPI.</p>\n', 'user_AccountId': 5023243.0, 'user_DisplayName': 'unixmiah', 'user_Reputation': 366.0, 'user_Views': 98.0, 'user_id': 84011.0}}