0

I am working on a remote virtual machine running Centos 7 via ssh. I want to give my user read and write permissions on /var/www/html. What I did is:

sudo groupadd webdev 
sudo chgrp -R webdev /var/www/html 
sudo usermod -a -G webdev centos 
sudo usermod -a -G webdev root 
sudo chmod -R 770 /var/www/html  
sudo chown -R root:webdev /var/www/html

Some checks I made:

groups centos
>> centos : centos adm wheel systemd-journal webdev

sudo ls -l /var/www/html
>> -rwxrwx---.  1 root webdev   418  6 feb 11.19 index.php
...

However, when I try to edit a file (e.g. index.php) without sudo, I get a blank file in nano. Moreover, I cannot upload files with sftp on this folder and user centos. How can I fix this?

firion
  • 99
  • 1
  • 5
  • Are you certain that you are using `nano` with the correct path and filename? If there is a typo somewhere and the file doesn't exist then nano will open an empty file. If you are running `nano index.php` then run `pwd` to make sure that you are in the right directory. – Nasir Riley Feb 15 '18 at 16:34
  • Yes, check the path. Also, do a `cat /full/path/to/file` to see if you can read it. Do you have selinux configured? check that. – Tux_DEV_NULL Feb 16 '18 at 08:00

0 Answers0