logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Strange problem bind mounting a directory from CGI script
Author
pdeline



Joined: 29 Sep 2015
Posts: 2
Location: United States, Austin

PostPosted: Tue 29 Sep '15 16:25    Post subject: Strange problem bind mounting a directory from CGI script Reply with quote

I have boiled down the issue to a very simple script.

Code:

#!/bin/bash

echo "Content-type: text/html"
echo ""
echo ""

echo "<p>Hello</p>"

echo "<p>Results from pid #{$$}:</p>"
echo "<ul>"
  c="sudo mkdir /shares/target"
  echo "<li>Executed '$c', Results: " $(eval $c) "</li>"

  c="sudo mount --bind /root/source /shares/target"
  echo "<li>Executed '$c', Results: " $(eval $c) "</li>"

  c="sudo mount | grep shares"
  echo "<li>Executed '$c', Results: " $(eval $c) "</li>"

  c="sudo cat /proc/mounts | grep shares"
  echo "<li>Executed '$c', Results: " $(eval $c) "</li>"
echo "</ul>"



The first two commands create a mount point and execute the mount. The last two commands verify the result. The script executes without issue. However, the mount is not visible or available in a separate shell process. Executing the last two commands in a separate shell does not show the mount being available. If I attempt to execute "rm -rf /shares/target" I get "rm: cannot remove '/shares/target/': Device or resource busy”. Executing "losf | grep /shares/target" generates no output. In a seperate shell I have switch to the apache user but the mount is still not available. I have verified the apache process is not in a chroot by logging the output of "ls /proc/$$/root". It points to "/".

I am running:
Apache 2.4.6
CentOS 7
httpd-2.4.6-31.el7.centos.1.x86_64
httpd-tools-2.4.6-31.el7.centos.1.x86_64

I turned logging to debug but the error_log indicates nothing.

Thanks in advance.
Back to top
pdeline



Joined: 29 Sep 2015
Posts: 2
Location: United States, Austin

PostPosted: Thu 01 Oct '15 3:47    Post subject: Reply with quote

Answered here:

http://stackoverflow.com/questions/32869660/bind-mount-not-visible-when-created-from-a-cgi-script-in-apache
Back to top


Reply to topic   Topic: Strange problem bind mounting a directory from CGI script View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner