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

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?

Related

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.

MailKit dotnet core on 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

Can't create working meteor.js project on a vagrant box

I cannot start up a new Meteor application on a Vagrant linux box (running on a Mac). It fails every time with a 'unspecified uncaught exception' in Mongo. I have tried a bunch of things to get this going, but even with the simplest set-up, I cannot get the project running. I would be grateful for any suggestions.
My steps are:
create a completely clean Vagrant box ("ubuntu/trusty64");
install Meteor on the new box (curl https://install.meteor.com/ | sh);
choose a location to create the project;
create a new Meteor project (meteor create app);
start up the project (cd app; meteor)
I know that the permissions on the vagrant shared folder are quirky, so for step #3 above I have tried putting the project:
in the shared guest/host folder, /vagrant,
in a subdirectory of the Vagrant home folder (/home/vagrant),
in a subdirectory of / (with permissions set to vagrant:vagrant), and
in a subdirectory of / with permissions set to root:root, the project created with sudo meteor create app and run with sudo meteor
In all cases, I see this error:
=> Started proxy.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.
I cannot tell if this is a Vagrant issue (though I think not, given what I've tried) or a Meteor issue, but I suspect it is Meteor (or one of its many dependencies). I doubt it is a permissions issue, since it failed when running as root. I've tried building meteor from scratch and the build fails and I've tried creating the project with --release 0.9.0 and --release 0.9.2-rc1 and the download is simply killed without explanation.
(1) After step 2 'install Meteor on the new box (curl https://install.meteor.com/ | sh)'
user$ cd /vagrant
user:/vagrant$ meteor create myApp
You should see the myApp folder on your Mac host (the same folder for the vagrantfile)
(2) Insides the myApp folder, you will see the default .meteor folder, make a folder called local if it is no there
user:/vagrant$ cd myApp/.meteor
user:/vagrant/myApp/.meteor$ mkdir local
(3) Create the same folder structure in the /home/vagrant
user:/vagrant/myApp/.meteor$ cd ~
~$mkdir -p myApp/.meteor/local
(4) Link or mount the /vagrant/myApp/.meteor/local to /home/vagrant/myApp/.meteor/local
sudo mount --bind /home/vagrant/myApp/.meteor/local/ /vagrant/myApp/.meteor/local/
or make it permanently
echo “sudo mount --bind /home/vagrant/myApp/.meteor/local/ /vagrant/myApp/.meteor/local/” >> ~/.bashrc && source ~/.bashrc
(5) Now you can start the meteor
~$cd /vagrant/myApp
user:/vagrant/myApp$meteor
The reason why I mount the local folder rather than the <.meteor> folder is that you can still edit the files insides the <.meteor> folder on your Mac host. You can replace myApp with whatever name you want
Hope this help
I'm working with a Windows host, but maybe this will apply to your situation as well.
The only folder which causes the issue is ./meteor/local. If you relocate this with a symlink to be outside of the shared /vagrant folder you should be able to run the meteor app okay.
But, to put a symlink in the shared folder you need to enable symlinks in the VM... which requires starting Vagrant as an admin.
I put together an Vagrantfile with some scripts and instructions here:
https://github.com/ElectronVector/vagrant-meteor
I ran into similar issues trying to run meteor on windows. It seems that mongodb is not able to write in the /vagrant folder. I solved this by doing
sudo mount --bind /home/vagrant/meteorapp/.meteor/ /vagrant/meteorapp/.meteor/
(got that from https://gist.github.com/gabrielhpugliese/5855677)
Here is an answer that solved my problem. Launching meteor project from a shared folder on Debian VMware virtual machine(running on a Windows).
The issue is that mongodb can't create data files inside a shared folder, so in this case just use an existing mongodb for meteor project:
export MONGO_URL=mongodb://localhost:27017/your_db
Doing
vagrant reload --provision
solved my problem.
I think the reason might be some files got corrupted or deleted.

file/directory permission centos 6.2

On Centos6.2 I am trying to get mod_wsgi (with Django) running. I serve two sites from one directory, and on Centos 5.2 everything works fine. In the logs I got "access denied errors" for the second domain.
To find out were the problem is I created a test directory in the home dir of user A with permission 777, and tried to access this as user B. On Centos 5.2 I can access the test directory, in Centos 6.2 not.
My first thought was that Selinux was active, but Selinux is disabled.
[root#server sysconfig]# sestatus
SELinux status: disabled
Any idea?
New directories in the home directory are created with permission 710. In the old Centos they were created with 711. Changing a directory to 711 does the trick.

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