MailKit dotnet core on Ubuntu 16.04 - ubuntu-16.04

Running a Kestrel server managed by systemd using www-data user. When trying to send an email using MailKit with TLS enabled I get the following error message:
System.UnauthorizedAccessException: Access to the path '/var/www/.dotnet/corefx/cryptography/crls' is denied. ---> System.IO.IOException: Permission denied
One solution possibly is to set a home directory for www-data, but that seems counter intuitive.

The call stack indicates that the code (MailKit or one of its dependencies) is trying to build and access a certificate cache.
You can manually create the directory and grant the necessary permissions.
Don't modify /var top directory as that's crazy.
First, you need to recursively create the directory:
mkdir -p /var/www/.dotnet/corefx/cryptography/crls
and give rights to www-data group
(if this is the group that runs your service)
sudo chgrp www-data /var/www/.dotnet/corefx/cryptography/crls

Related

Error: EACCES: permission denied, only in VSCode using Remote SSH

I can find plenty of references to this error, but they all point to permission issues, however my permissions appear to be fine as I can modify this folder using nano and SSH.
I'm trying to use RemoteSSH with a custom user account, user
The server is running Debian 11 and nginx
I have key based auth and I connect to the server. When I try to create or remove a file in the web folder (/var/www/html) I get this error message Error: EACCES: permission denied, <what I was trying to do, i.e. rename a file, or delete a file>
I can do all of these things using a standard SSH connection (openSSH built in to Windows 10)
The owner of /var/www/ is set to www-data (recursively)
user is a member of the group www-data
Do I need to do anything in VSCode to update permissions? Am I missing something else?
Here are the exact commands I used:
sudo adduser user www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R 0775 /var/www
OK I did a bit more Googling right after posting this, and I was able to fix this by deleting the .vscode-server folder in the home directory.
https://github.com/microsoft/vscode-remote-release/issues/3399#issuecomment-922935448
I'm not sure if there is an easier way to fix this without doing so, or having to do that every time permissions are changed.

Linphonec on RaspberryPi: how to solve "bctbx-error-bctbx_file_open (Permission denied)"

In my setting I want the user www-data to be able to run linphonec, but there's one error in my way, that I don't know how to handle so far.
When starting linphonec as user www-data:
sudo -u www-data /usr/bin/linphonec
I get the error:
bctbx-error-bctbx_file_open: Error open Permission denied
Where do I have to give permission to user www-data for this to work?
When running it as root there's no problem but I don't want to give www-data root rights.
My setting is:
RaspberryPi 3/4,
with newest Raspian OS,
newest version of "linphonec-cli" installed
raspbi is only accessible in local network and router blocks outgoing calls from it to prevent missuse.
After checking with strace I realized thet the issue must be somewhere else, since I couldn't find a single EACCES error in the strace log.
The root of the error was in my basic configurations file (linphonerc) that I copied over from another existing user. I changed the root_ca directory (after copying the files to the new location and changing rw-rights and ownership). After that linphonec runs without the error when starting with -c parameter and path to linphonerc file.
So the reason was most likely that wrong/unreachable root_ca= configuration.

mkdir(): Permission denied in Yii2

After installing yii2, I got the following error.
Some suggests that I should give full permissions to IIS_IUSRS but still to no avail.
You shouldn't need to set the permissions to 777, that is a security problem as it gives read and write access to the world.
It may be that your apache user does not have read/write permissions on the directory.
If you use Ubuntu do this :
Make sure all files are owned by the Apache group and user. In Ubuntu it is the www-data group and user
chown -R www-data:www-data /path/to/webserver/www
Next enabled all members of the www-data group to read and write files
chmod -R g+rw /path/to/webserver/www
The php mkdir() function should now work without returning errors

Sinatra app being run by user 'nobody' in shared folder on VM

I have a folder on my host OS (Windows 8.1) which is set up as a shared folder with VirtualBox (running Ubuntu 14.04 Server). The shared folder is set up correctly, but is giving me problems regarding permissions when I try to run apps which are inside of it.
All the files in the shared folder are owned by root and the group vboxsf. I have added my current user and the Apache user to the vboxsf group using the following commands:
sudo adduser cornflakes24 vboxsf
sudo adduser www-data vboxsf
However, when I visit my web browser to test the app, I am greeted with the following error:
This web application process is being run as user 'nobody' and group
'nogroup' and must be able to access its application root directory
'/var/www/html/webdev/ruby'. However, the parent directory
'/var/www/html/webdev' has wrong permissions, thereby preventing this
process from accessing its application root directory. Please fix the
permissions of the directory '/var/www/html/webdev' first.
The webdev folder in reference above is actually a symlink:
lrwxrwxrwx cornflakes24 www-data webdev -> /media/sf_webdev.
How can I get around this?

Php Setting File permissions for OrangeHrm in Ubuntu system

I am trying to deploy OrangeHrm in Ubuntu Server but getting the following errors..
Component Status
PHP version OK (ver 5.3.3)
MySQL Client OK (ver 5.1.52)
MySQL Server OK (ver 5.1.52)
MySQL InnoDB Support Enabled
Write Permissions for "lib/confs" Not Writeable*
Write Permissions for "lib/logs" Not Writeable*
Write Permissions for "symfony/config" Not Writeable*
Write Permissions for "symfony/apps/orangehrm/config" Not Writeable*
Write Permissions for "symfony/cache" Not Writeable*
Write Permissions for "symfony/log" Not Writeable*
Maximum Session Idle Time before Timeout OK
Register Globals turned-off OK
Memory allocated for PHP script OK
Web server allows .htaccess files OK
* Web server requires write privilege to the following directory
I have changed the file accessing permission as
"sudo chmod 777 orangehrm" and the folder is in 777 mode, still the errors exist.
Thanks..
For me it helped to change the the owner of the corresponding directory to www-data:
Go to the directory your web page data is in (usually /var/www/YOUR_SITE_NAME): cd /var/www/YOUR_SITE_NAME
Change the owner to www-data: sudo chown -R www-data . Alternatively, you can change the group, too e.g. to you username's group, in order to be able to access the files from you account: sudo chown -R www-data:YOUR_USERNAME . Note that in both cases the dot at the end of the command is part of the command!
You shouldn't be setting all folders to 777 for a web facing site. Run something like the following from your orangehrm folder;
sudo chmod 760 lib/confs lib/logs symfony/config symfony/apps/orangehrm/config symfony/cache symfony/log
That will give you read/write/execute for the owner and then read/write for the group and then no permissions for all others.
Then make sure the owner of the orangehrm folder is your web user ie, www-data
I would suggest confirming the permissions for those folders with the orangehrm forum.
ie, http://forum.orangehrm.com/viewtopic.php?f=14&t=2531&p=3452&hilit=chmod&sid=e53a96e31a32ce4cbfa7998f43fdfc95#p3452
you should include -R in your command, like :
sudo chmod -R 777 orangehrm