How to rewrite `-r-------- 1 apache apache a.txt`? - permissions

There's a file -r-------- 1 apache apache a.txt.
Now,I open GNOME Terminal 3.14.3. Even su root cannot rewrite this file.
How can I solve this problem?

Try the following commands:
sudo chmod 777 a.txt
sudo cp a.txt /home/your-username/a.txt
Now make your changes and run the following commands:
sudo chmod 777 a.txt
sudo cat /home/your-username/a.txt > a.txt
sudo chmod 400 a.txt
Note: Make sure that you replace /home/your-username with your home folder and you set the working directory to the directory where the file is in.

Related

Magento httpd permissions issues

I am trying to install magento2 on a CentOS server. I am continuously getting permissions issue, the magento diretory is owned by apache and I set permissions to 777 (i know it is bad but just to test) but I still get permissions denied on file write. the path to magento dir is /var/www/html. I set permissions to /var/www/ and all sub-folders to 777 and file owner to apache still same.
also
egrep -i '^user|^group' /etc/httpd/conf/httpd.conf (returns)
User apache
Group apache
any suggestions or ideas, please?
Kind Regards
Sajid
Try following steps
sudo /usr/sbin/groupadd wwwrun
sudo usermod -g wwwrun test
cd /var/www/html/magento2 && sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && sudo chown -R apache:apache . && sudo chmod u+x bin/magento
where test is the current logged-in user and then restart the http server.

file permission magento2 app/etc

Hi I am trying to install magento2 on a vps centos
I followed the instructions about file permission in magento documentation
http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html
I got the same erorr while installing :
/var/www/html/magento2/app/etc" Not writable, change the permissions.
Do I need to restart apache after I change some permissions.
Thanks for help.
If you are using the setup wizard, it will ask you for permission to write to the app/etc/env.php
I would advise you to use the bin/magento cli tool to setup the app:
php bin/magento setup:install
But it is fine to temporary allowing the web server to write to your env.php, after the UI wizard finished you can change it back to the correct file permission.
For this you need to clear cache.
php bin/magento cache:flush
or you can switch to the developer mode
php bin/magento deploy:mode:set developer
Use below commands to set permissions and then restart apache:
sudo usermod -g wwwrun <yourusername>
cd /var/www/html/magento2 && sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && sudo chown -R apache:apache . && sudo chmod u+x bin/magento
You need run this code:
chcon -R -t httpd_sys_rw_content_t /var/www/html/magento2/
chmod -R a+w /var/www/html/magento2/
Note: Magento2 is folder where you was install magento

Smart SVN Folder permission

I am using smartsvn on windows and i have wordpress site configured with that, but i have 2 issues,
When i make changes on my local machine and commit it reflects after 1 day, i don't know why 1 day delay,
Also recently i am having issue with upload folder , due to folder pemission i can not upload image and i don't know how to change folder permission
define('CHMOD', '777');
chmod -v 746 DIR
chmod -v 747 DIR
chmod -v 756 DIR
chmod -v 757 DIR
chmod -v 764 DIR
chmod -v 765 DIR
chmod -v 766 DIR
chmod -v 767 DIR

Apache File permissions issue in Ubuntu

I'm trying to use Apache to access a file on my Documents folder.
I tried the following:
sudo chown -R www-data:www-data /home/$USER/public_html
sudo adduser $USER www-data
sudo chmod -R 775 /home/$USER/public_html
As suggested by this post:
https://askubuntu.com/questions/26848/permissions-issue-how-can-apache-access-files-in-my-home-directory
Although this works, now I cannot edit or the files directly as the user (without using sudo), despite being a member of the www-data group. The only solution that seemed to work is using chmod -R 777 (which I rather not do).
Turns out all I had to do is restart the OS and it was sorted!

ubuntu : can't cd to /var/www despite being in www-data group

Am trying to set up a web site in an apache2 www folder on ubuntu 12.04 LTS.
Installed the LAMP as per the manual: sudo apt-get install lamp-server^
Then have done:
$ usermod -g www-data myuser
$ sudo chown -R www-data:www-data /var/www
$ sudo chmod -R go-rwx /var/www
$ sudo chmod -R g+rw /var/www
$ sudo chmod -R o+r /var/www
So, was going to copy files into www..
But when I (as myuser) try to
$ cd /var/www
I get :
-bash: cd: /var/www: Permission denied
Not sure what to do now...myuser is in the www-data group...
But, one thing that might not be right is that my user is only in sudo and www-data... should it be in users as well?
Thanks
You need to add executable permissions to a folder in order to be able to cd into it.
So, you should have done:
$ sudo chmod -R g+rwx /var/www