Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
i have simple test.php page:
system("ls -la /tmp"); ?>
which always shows just: . and .. folders and nothing else in browser.
.
..
in the command line:
1) ls -la /tmp 2) sudo -u http ls -la /tmp 3) php test.php 4) sudo -u http php test.php
all this commands returns full list of directory files/subdirs.
What is the reason for this???
And problem is "/tmp" folder related because ls -lah /usr works OK.
ls -lah /usr
i tested this on 4 comps (one of them was debian with php 5.0.6 and there php shows all files OK like i expected, other 3 comps has php7 and shows empty /tmp).
update:
even after adding http to sudoers file and running 'sudo ls /tmp', problem is the same on php versions >7.
but runing 'system("echo aaa > /tmp/aaa.txt; ls -la /tmp") shows . , .. , and aaa.txt file owned by http:http. So is this some new php restriction and how it is posible to interfere on /tmp files only.
aaa.txt
update2:
but aaa.txt is not inside /tmp, and by running find /tmp -name aaa.txt, i see that it is inside /tmp/systemd-private-2cf1853410ad4ade980ec17e883771c3-httpd.service-lZ22gS/tmp/aaa.txt .
find /tmp -name aaa.txt
/tmp/systemd-private-2cf1853410ad4ade980ec17e883771c3-httpd.service-lZ22gS/tmp/aaa.txt
so finaly it is related to something called "systemd /tmp isolation"... that i need to learn about.
Changing true to false inside: /etc/systemd/system/multi-user.target.wants/httpd.service:
true
false
/etc/systemd/system/multi-user.target.wants/httpd.service
[Service] PrivateTmp=false ...
solves my problem, but i am wondering is it possible to avoid this without changing service file.
I am running Ubuntu 18.04 and /usr/lib/systemd did not contain any f="https://forum.tuteehub.com/tag/services">services for http or f="https://forum.tuteehub.com/tag/apache2">apache2. However, I executed the following f="https://forum.tuteehub.com/tag/command">command:
sudo find / -f="https://forum.tuteehub.com/tag/mount">mount -type f -exec grep -e "PrivateTmp" '{}' ';' -print
and found in /lib/systemd/f="https://forum.tuteehub.com/tag/apache2">apache2.service the PrivateTmp=true. Changing true to false and executing
systemctl daemon-restart systemctl restart f="https://forum.tuteehub.com/tag/apache2">apache2
fixed the problem.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.