marklogic user app server - xquery

Which user the MarkLogic runs under if I do a default install?
I am on linux mint ML version 6 and I am doing the labs unit 5
creating the 8030-world-leaders app
In the setupdb.txt I have changed to script to use a directory in my home
like:
(: application server :)
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $groupid := admin:group-get-id($config, "Default")
let $server := admin:http-server-create(
$config,
$groupid,
"8030-world-leaders",
"/home/hugo/mls-projects/world-leaders",
8030,
0,
admin:database-get-id($config, "world-leaders"))
return admin:save-configuration($server);
but now i get a 500 error like:
500 Internal Server Error
SVC-FILSTAT: File status error: stat64 '/home/hugo/mls-projects/world-leaders/': Permission denied
[1.0-ml]
I have chmod this dir to have a+rw but still this permission denied error.

By default the server runs as daemon.
To be listable, directories must also be executable. Try:
chmod -R a+r /home/hugo/mls-projects/world-leaders
find /home/hugo/mls-projects/world-leaders -type d -print0 | xargs -0 chmod a+rx
You may also need to check the parent /home/hugo/mls-projects and grandparent /home/hugo directories. If necessary, make sure they are also a+rx.
See also chmod: cannot read directory `.': Permission denied

Related

Warning: file_put_contents(sites/default/files/php/twig/5ec7c76bcb94c_menu.html.twig_ms5R93s-wUkYaDlrCxbz7FVzS/.htaccess): failed to open stream:

We are using Drupal8.7.5 headless, continuously we are getting such warning.
So my Question was do we need twig cache enabled.
How to solve the warning appearing in logs.
Those kind of messages are a folder permission problem at the most of time. And may be it's the case of your Drupal installation.
So I invite to verify the owner of "files" directory:
chown -R :www-data files
Then setting the proper permission on the Files directory:
chmod g+ws files
Fixing the permissions of pre-existing files in the Files directory:
cd files && find . -type d -exec chmod g+ws {} \ && find . -type f -exec chmod 664 {} \;
As recommended by Chris Toler.
And be careful because may be you are using a Dockerfile that force Nginx to use another user then www-data or may be you are using a shared volume for "files" directory as a cloud webapp. In that case you need to verify permissions on volumes at the host machine or using the Cloud UI to find the right permissions for your volumes. For further reading you can take a look at this Drupal topic.

Symfony log file permissions on docker

I have a similar configuration with other project, and It run good. But, this project get problem:
Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/docker/test-project/var/logs/prod.log" could not be opened: failed to open stream: Permission denied in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(122): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\FingersCrossedHandler->handle(Array) #3 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(643): Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array) #4 /home/docker/test-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php(89): Monolog\Logger->critical('Uncaught PHP Ex. in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
I tried: http://symfony.com/doc/current/setup/file_permissions.html and I don't get a good result
Since you have a nginx tag, maybe you are also using nginx as the web server, if so, you might need to do some configuration there:
http://symfony.com/doc/current/setup/web_server_configuration.html#nginx
Your question and setup should be described in your question. If you can edit and update, that would be good.
There is log file permission problem. Docker has not support setfacl with default filesystem driver.
Try this solution as described in symfony documentation:
change the umask so that the cache and log directories are group-writable or world-writable (depending if the web server user and the command line user are in the same group or not). To achieve this, put the following line at the beginning of the bin/console, web/app.php and web/app_dev.php files:
umask(0000); // This will let the permissions be 0777
The solution was to run this command into project directory:
$ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`

Permisson denied to open liteloader-1.7.2.jar

I was downloading a mod for minecraft. Although it is not excutable so I put in ( chmod +x liteloader-1.7.2.jar ) but after that it has a lock on it. So I clicked on it and it said
error: cannot open zipfile [ /home/family/Desktop/liteloader-1.7.2.jar ]
Permission denied
zipinfo: cannot find or open /home/family/Desktop/liteloader-1.7.2.jar, /home/family/Desktop/liteloader-1.7.2.jar.zip or /home/family/Desktop/liteloader-1.7.2.jar.ZIP.
Permission denied! Can you help me?
Try to grant administration privileges using the sudo command!
So basically:
sudo chmod +x yourfile.jar
You have to run it in the terminal with java, try running it with this command: java -Xmx2048M -Xms1024M -jar /home/family/Desktop/liteloader-1.7.2.jar
Note that the Xmx and Xms set the amount of memory Minecraft gets to use.

Nginx not following symlinks

I have installed nginx on Ubuntu 12.04. However, nginx does not seem to follow symlinks. I understand that there is a config change required for this but I am not able to find where to make the change. Any help appreciated.
In my case nginx was already configured to follow symbolic links. But the issue was the user nginx could not access my home files and therefore symbolic link to my home directory was not working.
Example
Suppose we have symbolic link /usr/share/nginx/www/mylink -> /home/u/html
cd /usr/share/nginx/www
mkdir -p /home/u/html
sudo ln -sv /home/u/html mylink # creates mylink -> /home/u/html
Give permissions
Give the read and execute permissions using chmod and find:
chmod +rx /home/u
chmod +rw /home/u/html
find /home/u/html/php -type d -exec chmod +rx {} +
find /home/u/html/php -type d -exec chmod +w {} + # optional
Notes:
The permission x is named execute. But when applied to a directory, this permission allows to recurse the directory tree (see Unix modes).
The command find ... -exec chmod ... recursively changes the permissions. We could also use the command chmod -R +rx /home/myuser/html but this last command also gives the execution permission to all regular files, and we do not want that. The option -type d execute chmod to only directories.
The last optional command gives write permission if your PHP scripts require to write data. Try to limit write permission to only required directories for security reasons.
Test
No need to restart ngnix, just press Ctrl+F5 in your browser.
Caution: It is not recommended to create symbolic links pointing to your home directory because a mistake on read/write access or a wrong symbolic link may expose your digital data...
Reference: Arch wiki on nginx
Have a look at the following config option from nginx docs:
Syntax:
disable_symlinks off;
disable_symlinks on |
if_not_owner [from=part];
Default: disable_symlinks off;
Context: http, server, location
This directive appeared in version 1.1.15.
if olibre's answer doesn't help edit the file /etc/nginx/sites-available/default and add this line where you've specified your server root directory.
autoindex on;
save the file and restart server
/etc/init.d/nginx restart

testlink installation failed: checking if /var/testlink/logs/ directory exists

Today, I installed testlink. And after I select 'new Installation' and choose 'I agree' option, it failed at the second step. The failed message are as following:
Read/write permissions
For security reason we suggest that directories tagged with [S] on following messages, will be made UNREACHEABLE from browser
Checking if C:\xampp\htdocs\testlink\gui\templates_c directory exists OK
Checking if C:\xampp\htdocs\testlink\gui\templates_c directory is writable (by user used to run webserver process) OK
Checking if /var/testlink/logs/ directory exists [S] Failed!
Checking if /var/testlink/upload_area/ directory exists [S] Failed!
So, can anyone give me a hand? Many thanks!
In C:\xampp\htdocs\testlink\config.inc.php file, change
$g_repositoryPath = 'C:\xampp\htdocs\testlink\upload_area';
$tlCfg->log_path = 'C:\xampp\htdocs\testlink\logs';
Worked for me , make sure you dont have the slash at the end.
i.e, make sure that it is NOT:
$g_repositoryPath = 'C:\xampp\htdocs\testlink\upload_area\';
$tlCfg->log_path = 'C:\xampp\htdocs\testlink\logs\';
If you installed the XAMPP or testlink in another directories, change the paths above accordingly.
Go to config.inc.php and log directory ($tlCfg->log_path) edit the path to C:\xampp\testlink\logs and upload directory ($g_repositoryPath) to C:\xampp\testlink\upload_area
In some cases, you would do like this:
Go to C:\xampp\htdocs\testlink\config.inc.php1
and log directory ($tlCfg->log_path) edit the path to C:\xampp\htdocs\testlink\logs
and upload directory ($g_repositoryPath) to C:\xampp\htdocs\testlink\upload_area
Then you have:
$g_repositoryPath = 'C:\xampp\htdocs\testlink\upload_area';
$tlCfg->log_path = 'C:\xampp\htdocs\testlink\logs';
I had paths set correct , also user, group and access are set correct and still can not get rid of issue. It took me very long to go to the root cause, the issue lies at- http daemon does not have access to file in concern due to SELinux policies. So simple chown, chmod would not help(group and user access). For testlink 1.16 I resolved it with re-installing with sudo user, but for upgrade, an issue arose again even with sudo user.
And resolved issue by executing following commands, I hope this helps. (Note: You might have to mend attributes to run it successfully)
$chcon -t httpd_sys_content_rw_t "<path_to_testlink_folder>/gui/templates_c/"
$chcon -t httpd_sys_content_rw_t "/<path_to_testlink_folder>/upload_area/"
$chcon -t httpd_sys_content_rw_t "<path_to_testlink_folder>/logs"
$semanage fcontext -a -t httpd_sys_content_rw_t "<path_to_testlink_folder>(/.*)?"
$restorecon -R -v path_to_testlink_folder
Ubuntu 12.04 - All you have to do is chmod 777 these directories, Fails will become Pass.
~$ cd into /var/www/testlink
~$ sudo chmod 777 ./gui/templates_c/
~$ sudo chmod 777 ./upload_area/
~$ sudo chmod 777 ./logs/
Whatever the instructions say is total BS. Making these directories unreachable from browser is optional, and that created a confusion. if you chmod 777 them, your Fails will turn into pass and now you'll be able to proceed to step 3 of your testlink installation. Tested with testlink version 1.9.5.
For Mac OS Users try this in 1.9.19 version:
Make Sure with your folder name.
In config.inc.php file:
$tlCfg->log_path = TL_ABS_PATH . 'logs' . DIRECTORY_SEPARATOR;
$g_repositoryPath= TL_ABS_PATH . 'upload_area' . DIRECTORY_SEPARATOR;
After this if you got read write permission issue failed.
Goto testlink -> logs / upload_area -> press Command + I -> in Permission Enable Read Write to Everyone.
on Linux; ensure the paths are as follows:
$tlCfg->log_path
$g_repositoryPath
are
/var/www/html/testlink/logs/
/var/www/html/testlink/upload_area/
Valid for ubuntu 16.04 LTS add permisions
Change:
$g_repositoryPath = 'var/www/html/testlink/upload_area'; //linux user
$tlCfg->log_path = 'var/www/html/testlink/logs';
~$ cd into /var/www/testlink
~$ sudo chmod 777 ./gui/templates_c/
~$ sudo chmod 777 ./upload_area/
~$ sudo chmod 777 ./logs/
In CentOS go to /var/www/html/testlink-code-1.9.16 and edit the file custom_config.inc.php replace these two lines
// $tlCfg->log_path = '/var/testlink-ga-testlink-code/logs/'; /* unix example */
// $g_repositoryPath = '/var/testlink-ga-testlink-code/upload_area/'; /* unix example */
with
$tlCfg->log_path = '/var/www/html/testlink-code-1.9.16/logs/';
$g_repositoryPath = '/var/www/html/testlink-code-1.9.16/upload_area/';
Make sure you have disabled the selinux. If not to do so edit the file /etc/sysconfig/selinux and change the variable SELINUX to disabled and reboot the machine. Now these errors should have gone.
on ubuntu 18.04, will need to run
apt-get remove apparmor
in order to install it
To solve the problem :
Checking if /var/www/html/testlink-1.9.16/gui/templates_c directory is writable (by user used to run webserver process) on Centos 7.
Disable SELinux, and then restart your system.
You should no longer have this error message.

Resources