vagrant puppet unable to chmod to make executable - permissions

I have a vagrant 1.6.3 debian 7.5 with a TYPO3 6.2.9 installation and I'm trying to make a php file executable
chmod a+x typo3/cli_dispatch.phpsh but it's not working - not even as root.
When I log out, however, I see that the file has changed permissions outside in my host machine.
I tried adding
file {'/home/vagrant/docs/typo3/cli_dispatch.phpsh': mode => 0777} to the puppet manifest, but nothing seems to happen.
Can somebody perhaps shed some light on how to make files executable inside the vagrant box?

reson could be the folder you are working with is protected ,
you can try
chattr -i /home/vagrant/docs/typo3/cli_dispatch.phpsh
and try to change permissions again

Related

How to not use sudo in XAMPP?

I am using XAMPP on Ubuntu 20.04. It has been installed at the location opt/lampp/ location.
As usual before writing any code I am saving my php file within opt/lampp/htdocs location.
Now, every time I make changes to any file or want to save it I have to use the command line with sudo and obviously type my password again and again and again.
Could there be a way around this?
And not install xampp in root directory or but some other directory which is not within root directory?
Thank you.
I have found a solution to the problem. Now I can create files with in the specific folder of htdocs.
My location of installation of xampp was default one opt/lampp
Go the parent folder of htdocs that is /lampp and type
sudo chown -R $USER:$USER ./htdocs
Now go to the parent folder of ./lampp and type
sudo chmod -R 755 ./lampp/
Here what we basically did was change the permission to create folder and make changes to the file to the location where we have installed xampp.

vagrant ssh uses wrong ssh executable

I have a vagrant box with CentOS7 running under KVM/QEMU (libvirt) on my Fedora 29 host. vagrant up works fine. vagrant ssh fails with:
/usr/share/vagrant/gems/gems/vagrant-2.1.2/lib/vagrant/util/safe_exec.rb:39:
in `exec': : Permission denied - /home/username/bin/sshPermission denied - /home/username/bin/ssh ( (Errno::EACCESErrno::EACCES)
The doc says: Vagrant will attempt to use the local SSH client installed on the host machine. However, which ssh correctly results in: /usr/bin/ssh. So why vagrant doesn't use it ?
The directory! /home/username/bin/ssh was included in the PATH env when the box was created and vagrant seems to have stored this information somewhere. Removing the directory from PATH didn't help. Only when I rename or remove the directory vagrant ssh does work.
Can anyone tell me where vagrant stored the wrong info ?
Edit: The Vagrantfile is nearly empty, only config.vm.box contained...
Guess I found the reason - seems to be a bug or strange behavior of the vagrant version 2.1.2 that I use:
I still had directory /home/username/bin in the PATH env. Vagrant seems to list all entries in all directories included in PATH to look for ssh and finds subdirectory /home/username/bin/ssh not realizing that this is a directory ...
After removing /home/username/bin the command vagrant ssh works as expected. So unless vagrant is improved I have to permanently rename my /home/username/bin/ssh directory ...

Docker Centos 7 image running Apache2 "DocumentRoot ... is not readable"

I have a docker container running a Centos 7 image. All it needs to do is run a simple Apache2 server. When the container starts it exits immediately with:
AH00526: Syntax error on line 119 of /etc/httpd/conf/httpd.conf:
DocumentRoot '/var/www/html' is not a directory, or is not readable
I did some basic checks:
Folder exists
Permissions are ```rwx r_x r_x root root```` for each folder /var/www/html
Tried chown -R apache /var/www (no straw shall remain unclutched!)
SELinux is disabled (... or is it?)
When I enter the container with a bash entry point, I can then start apache as root with /sbin/httpd -D FOREGROUND and everything works as expected.
So I think its almost certainly a permissions thing. Googling found many pages with my error e.g.
Apache restart causes DocumentRoot must be a directory, even though it is a directory and there seem to be no privilege issues
This particular page closely describes what I am getting and the solution in almost every page is configure SELinux. However SELinux is disabled. Even in that link there is comment from the OP
My version of linux isn't Security Enhanced Linux, so without understanding I tried it anyway: no effect.
Yet they accepted the solution which was configure SELinux.
I think I am missing something, almost certainly SELinux related, but I can't figure it out. The docker image has the following (distinct lack of) SELinux settings:
/etc/selinux contains only semanage.conf and tmp/ (empty)
/usr/sbin contains no se* executables
rpm -qa | grep selinux
libselinux-2.5-12.el7.x86_64
/etc/sysconfig/selinux does not exist
So in the Dockerfile I tried RUN echo "SELINUX=disabled" > /etc/sysconfig/selinux
doing yum install -y policycoreutils installs sestatus in /usr/sbin. Running sestatus gives
SELinux status: disabled
With or without /etc/sysconfig/selinux
It really looks like SELinux is disabled, yet the error looks so much like it is enabled.
The issue in this case was due to the way the container was launched.
I use docker-compose to launch this particular container but the paths for the volume mapping were incorrect.
I am still not sure why this causes apache to fail to start in the way it does but correcting the paths fixed the issue.

Vagrant make a file writable or executable

I have found that running
chmod u+x myfile
Does not work when I ssh into my local vagrant machine. Same thing for +/- for writable, in fact chmod has no effect. How can I modify permissions inside my vagrant instance?
Running on Windows 10 machine
VirtualBox version 5.1.10
Vagrant 1.8.7
Also this is the line in the Vagrantfile:
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
666 = rw-rw-rw- .. I'm suspecting that permissions aren't changeable since it remains that way no matter what I do.
(To clarify, my purpose is to practice with a PHP shell script, but I can't run the script if it's not executable)
You're telling vagrant to share the folder in full mode for directory (dmode) but to set permissions as 666 on file so you cant make an executable mode after.
If you have no particular reason to set the directory/file mode for your shared folder, jsut remove the mounting options and leave as
config.vm.synced_folder ".", "/var/www"
Below permission should be enough for write and execute.
chmod 755 filename

How can I configure my Laravel application to load using MAMP?

Environment
I use Mac OS X Yosemite, MAMP Version (3.0.7.3).
Document Root
I already set the document root to point to my laravel/public folder.
Permission
Some people recommend me to chmod my laravel folder entirely, I also did that as well by running chmod -R 777 laravel/.
Testing
Go to : http://localhost:8888/ , all I get is white space
How do I get this to work ?
I solve this problem by running:
composer update until I see:
The last thing is to go in to my /laravel folder and run :
chmod -R 777 /app/storage
Then Viola ! I see my site.