session start access denied, fail to open phpmyadmin - apache

At first i was trying to do the upload file function and some configuration. However though the file_upload is ON, the upload file function is still not working. After I do some configuration according to online tutorials my XAMPP server seems to have problem. These were the error messages when i run php file:
Warning: session_start():
open(/var/folders/_z/rzmc9ysn0r15n2_88d5y5lbh0000gn/T/sess_4ff2e15141e8e599a0617ccafaba00c9,
O_RDWR) failed: Permission denied (13) in
/Applications/XAMPP/xamppfiles/htdocs/presoft/session_test.php on line
4
Warning: session_start(): It is not safe to rely on the system's
timezone settings. You are required to use the date.timezone setting
or the date_default_timezone_set() function. In case you used any of
those methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected the timezone 'UTC' for
now, but please set date.timezone to select your timezone. in
/Applications/XAMPP/xamppfiles/htdocs/presoft/session_test.php on line
4
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/Applications/XAMPP/xamppfiles/htdocs/presoft/session_test.php:2) in
/Applications/XAMPP/xamppfiles/htdocs/presoft/session_test.php on line
4
I also can't access phpmyadmin and the error is:
Error during session start; please check your PHP and/or webserver log
file and configure your PHP installation properly. Also ensure that
cookies are enabled in your browser.
I'm using Xampp server on Mac OS.
I already looked into session.save_path and the location is "Application/XAMPP/xamppfiles/temp". Tried "/tmp" but still the same.

Give read/write permissions to your Apache user on temp directory in /Applications/XAMPP/xamppfiles/.
To know your OS user: open Terminal and use command whoami
To know your Apache user: Open httpd.conf file in /Applications/XAMPP/xamppfiles/etc/httpd.conf
and look for user yourusername and Group admin

Usually this comes from a permission problem with the session.save_path; in this case I suggest you check the permissions on /Applications/XAMPP/xamppfiles/temp/ and set them such that the webserver process can read and write files there.

Related

SSH - what is the meaning of permission denied(publickey, password)?

sorry if the question may be vague or not but I noticed that whenever I have tried to login to a ssh server it usually says "permission denied(publickey, password" or "permission denied(publickey, password,x, y)" where x and y are other strings but do these indicate what I could use to login to the server or are these the requirements needed to login to the server?
It only lists the list of attempted authentication methods that failed at the initiation of the connection.
As described in this article from Marko Aleksic
One reason for the error may be sshd_config, the file that contains SSH server configuration.
The other possibility is that the authorized_keys file has insufficient permissions
if you have access to the server, stop the sshd service, and restart it manually in debug mode:
sudo /usr/sbin/sshd -d
That way, you will see exactly what is attempted and why it fails.

Rundeck permission denied issue while executing a job in remote host machine

Earlier I have installed Rundeck in local machine and Everything was working fine for me . Recently I have installed rundeck in remote host machine where ssh and sudo user are different for this machine and they are not in same group .
When I am trying to run the job(python scripts) , it is throwing me below permisision denied message . Do I need to change the user level details somewhere in a file, Please let me know .
/bin/sh: /tmp/4-10-host-machine-dispatch-script.tmp.sh: Permission denied
Result: 126
Failed: NonZeroResultCode: Result code was 126
Thanks,
RK
That means the /tmp directory is restricted in your remote node (some servers setups restrict that by security reasons), you can define a custom copy script path in multiples ways:
1) Node level: defining file-copy-destination-dir attribute at resoruces.xml file, example:
<node name="freebsd11" description="FreeBSD 11 node" tags="unix,freebsd" hostname="192.168.33.41" osArch="amd64" osFamily="unix" osName="FreeBSD" osVersion="11.3-RELEASE" username="youruser" ssh-key-storage-path="keys/rundeck" file-copy-destination-dir="/home/youruser/scripts"/>
2) Project level: Go to Edit Configuration (Rundeck sidebar) > Edit Configuration > Edit Configuration File (up to right button) and add this line:
project.file-copy-destination-dir=/home/youruser/scripts
3) Globally: Stop Rundeck service, add the following line at project.properties (at /etc/rundeck path) file and start Rundeck service again:
framework.file-copy-destination-dir=/home/youruser/script
Just make sure that the custom path is reachable by the remote ssh user. You can check the full documentation here.

Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory

I'm using Deployer for deploying my code to multiple servers. Today I got this error after starting a deployment:
[Deployer\Exception\RuntimeException (-1)]
The command "if hash command 2>/dev/null; then echo 'true'; fi" failed.
Exit Code: -1 (Unknown error)
Host Name: staging
================
Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
Permission denied (publickey).
First I thought it would probably has something to do with this server configuration since I moved the complete installation to another hosting provider. I tried to trigger a deployment to a server which I deployed to just fine in the past days but then got the same error. This quickly turned my suspicions from server to local.
Since I'm running PHP in docker (Deployer is written in PHP), I thought it might had something to do with my ssh-agent not being forwarded correctly from my host OS to docker. I verified this by using a fresh PHP installation directly from my OS (Ubuntu if that would help). Same warning kept popping up in the logs.
When logging in using the ssh command everything seems to be alright. I still have no clue what going on here. Any ideas?
PS: I also created an issue at Deployer's GIT repo: https://github.com/deployphp/deployer/issues/1507
I have no experience with the library you are talking about, but the issue starts here:
Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
So let's focus on that. Potential things I can think of:
Is the username really user? It says that the file lives at: /home/user. Verifying that that really is the correct path. For instance, just ls the file. If it doesn't exist, you will get an error:
$ ls /home/user/.ssh/id_rsa
That will throw a No such file or directory if it doesn't exist.
If 1. is not the issue, then most likely this is a user issue where the permissions are wrong for the user in the Docker container. If this is the issue, then INSIDE the Docker container, change the permissions on id_rsa before you need to do it:
$ chmod 600 /home/user/.ssh/id_rsa
Now do stuff with the key...
A lot of SSH agents won't work unless the key is only read-write accessible by the user who is trying to run the ssh agent. In this case, that is the user inside of the Docker container.

Apache PHP and a CIFS write access

I've been working on an internal site that has Apache / PHP running.
I have CIFS Mount in a root directory. /filesys/Images/ that points to a file server.
My apache runs under the 'apache' user account.
The CIFS is mounted with the user and group of the apache user. (and 777)
When I write a PHP script to read or write from this CIFS mount and run it on the command line (both under normal and apache users) everything is fine.
As soon as I try to call the script from apache things fail. No read or write permissions.
My error log will show (for mkdir) 'file exists' although it does not.
My PHPInfo verifies that safe mode is not on.
Any ideas?
My problem had to do with SELinux and getting that configured properly.
semanage boolean -m --on httpd_use_cifs

How can I play a wav sound on the server side using cgi?

How can I run a command from a (bash) CGI script to play a wav sound on the server side?
You can execute your command line audio player as described by nak, but this may not work due to the permissions of the user running Apache. By default Apache is run as www-data:www-data (or apache:apache or www:www on some distros). As a quick fix/test you can set Apache to run as a user that has permissions to access the audio device on the machine by modifying your /etc/apache2/apache2.conf (or /etc/httpd/httpd.conf") file to have:
User USER_THAT_CAN_PLAY_AUDIO
Group USER_THAT_CAN_PLAY_AUDIO
Warning: this is not secure and is not intended to be a permanent solution!
This is how I would do it
#!/bin/sh
echo Content-type: text/plain
echo ""
echo "Server is playing sine.wav!"
aplay -q sine.wav
I stumbled over this old question looking how to solve the same problem: to have my personal Apache webserver warning me when someone makes a specific request (in my case a call for chat without the need to have any IM running).
The solution below is what I use on Slackware 14.1: according to your distro YMMV.
launch visudo
add the line TheUserRunningApache ALL=(ALL) NOPASSWD: /usr/bin/play (TheUserRunningApache is the user name used by your Apache)
In the PHP page you want to play a sound add this line: system ("sudo /usr/bin/play SOUND.WAV");
If you don't want to give access to Apache to the /usr/bin folder, even if limited just to play, you can copy the sox executable (the program used to run /usr/bin/play) elsewhere, but you'll have to modify the last two instructions above accordingly.