I am new to Linux and Apache and have beginners permissions issues ...
I installed Ubuntu and has installed and configured apache and PHP via SSH (putty) from my windows box. apt-get
I have installed WinSCP and has used that for file transfers from Windows to Ubuntu. That is working fine after i figured out how to the permissions on the website directory.
Now I have new permission problems when I try to edit /etc/apache2/apache2.conf
No matter what i try i get a permission denied.
I am trying to download the file using WinSCP, edit it windows and then upload the file again. This results in a
Permission denied.
Error code: 3
Error message from server: Permission denied
This is my current permissions:
drwxrwxr-x 8 root root 4096 Nov 16 16:24 apache2
-rwxrwxr-x 1 root root 7115 Jul 21 19:56 apache2.conf
Can anyone point me in to direction?
1) try to SCP as root user
2) try to login as root with SSH and use mcedit to edit the file
please note: in some systems, ssh to root user is prohibited by default, so you have to ssh to your user, and give the command: su (and enter the password) or sudo su if you have sudo rights.
to access via ssh, use PUTTY.
once you're in, install mc: apt-get install mc
after this, you can use mcedit: mcedit /etc/apache2/apache2.conf
mcedit is a really well designed editor, it's quite easy to use.
Related
I tried to install Nextcloud 13 in Plesk, but if I try to open the link I get a HTTP 500 error.
PHP version: 7.0.27
PHP modules: click here
php_error.log: too long (I can send the pastebin link)
Please tell me if you need more info. I would really appreciate any help.
You might have set the wrong file permission on your Nextcloud installation.
If you created the Nextcloud directory with root permission, you need to change the ownership of the directory to a user or a group, that Plesk has permissions for.
Use these commands to change the ownership (replace myPleskUser with the username you specified during the Plesk installation)
cd /var/www/vhosts/mydomain.tld/
chown -R myPleskUser ./nextcloud
chgrp -R psaserv ./nextcloud
I installed Laravel 5 on a new VPS, I was running everything fine but I noticed I wasn't getting any Laravel errors the system would only fire a server 500 error at me which is no help when debugging my code.
When I looked in the laravel storage/log it was empty which was strange because I had set the correct file permissions of 777.
So how do I get laravel logs? Why aren't they being written to my storage/log file.
If you've set your file permissions correctly on the /storage file directory and you're running on a VPS not shared hosting you might want to check your apache log, inside var/log/apache2/error.log
Here you might just see a line that read something along the lines of /var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
Well this is strange because you have the correct file permissions...
Let's start by SSH'ing into your VPS head to the directory where laravel is installed normally cd /var/www/html
In here if you run ls -l You should get some results similar to this image below:
Notice how we've been accessing the site as the root user, this is our problem and we can confirm this by running ps aux | grep apache2
You can see here apache2 is running as the user www-data, which is normal for apache. Which means when our laravel installation trys to move files either using ->move() or just trying to write the log file it fails as the www-data user doesn't have permission. So you can change to this www-data user by running: chown -R www-data:www-data * (shorthand for same user/group chown -R www-data. *)
Now if you run ls -l in your www/html directory you should see root user changed to www-data:
This means were now editing the files as the www-data user which has permission, so any changes you make via SFTP should reflect this user change. Fixed!
Edit - This is the first time I answered my own question hopefully it's okay.
I cannot seem to allow permissions in vagrant. I am attempting to run importbuddy.php in order to migrate a WordPress instance. I get the following error.
file_put_contents(/path/): failed to open stream: Permission denied
I have setup permissions to 777 on the www directory, but that changes nothing. Any idea on how to fix this?
While recursively setting folder and file permissions to 777 should fix your problem (instructions for doing so here), the root of this is probably an issue with the ownership of the files and folders.
The owner of shared folders is usually 'vagrant' but the server itself (if you're using Ubuntu) runs as user and group 'www-data'. You can view the user/group of your files by sshing into your VM (vagrant ssh), navigating to the directory in question and entering ls -l in your console.
If you're running apache, then you can update the user to 'vagrant' by editing the following file (/etc/apache2/envvars) like below:
Find this section
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
And change it to
export APACHE_RUN_USER=vagrant
export APACHE_RUN_GROUP=vagrant
Afterward just be sure to restart apache (with this command sudo service apache2 restart) and the file permission errors should be fixed
Our company's partners sent us custom Wordpress installation for website.
Installation contains 2 files:
installer.php
installation.zip (example)
I followed this guide to install Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04. Worked perfectly.
Then followed this guide to install Wordpress, but instead of downloading install from Wordpress website I used my custom installation.
Now those both files remain in /var/www/html
Then I accessed: http://my_server_ip/installer.php
And got this Error:
What I tried is:
Restarted Apache with sudo service apache2 restart
Set both file permisions to 777, now I got -rwxrwxrwx 1 root edgars
424438 Jan 20 07:52 installer.php
Changed file owner to edgars now it looks like this:
-rwxrwxrwx 1 edgars 30208410 Jan 20 07:58 201412166115237_archive.zip
-rwxrwxrwx 1 edgars 424438 Jan 20 07:52 installer.php
Restarted again Apache, but still can't pass that test..
Any help would be great.
Thanks.
This tells you that PHP can't write into /var/www/html, so you have to change permissions in that directory. It looks like you're only changing the file permissions and not the directory.
Also, don't use 777, 755 should be enough. Or better yet, just set the directory ownership to whatever apache's username is (usually www-data).
Commands:
# change permissions of directory
chmod -R 755 /var/www/html
# change ownership of directory
chown -R www-data:www-data /var/www/html
www-data may or may not be the user apache's using for its processes; you can check for the actual username using:
ps aux | egrep '(apache|httpd)'
You can try
sudo chown root:www-data -R /var/www/html
It gives permissions to group root & user www-data.
Hope it helps.
Hi I just installed ubuntu alongside my Win 7 and I have been using xampp and am very familiar with it, but I just installed lamp and am using the apache2, php, and mysql from terminal and I copied a web folder over from my xampp side and it is saying that I do not have permission to access that file.
I know that on my pc I had some htaccess files but on Ubuntu I am yet to figure out how to view those. Is this a product of those .htaccess files or something else?
That happens if you install WAMP/XAMMP on system partition.
so you copied the files form windows to linux?
sounds like a classic file permissions problem.
per default the www folder is in /var/www, so you can simply set the owner of this folder to the apache user which is called www-data, run this in terminal:
sudo chown -R www-data:www-data /var/www
but now you will no longer be able to write to those files yourself, because they are owned by www-data. checkout this answer for more details and how to get write access: https://askubuntu.com/a/51337
or you make it writeable for everyone (which is a bad idea): sudo chmod -R 777 /var/www
about editing .htaccess files:
I don't use linux with a graphical user interface, but you can edit them with the terminal editor of your choice, on ubuntu you have nano installed by default:
nano /var/www/.htaccess
or if you want a more advanced editor, I suggest vim https://help.ubuntu.com/community/VimHowto
vim /var/www/.htaccess