spike1x
By:
spike1x

I've messed up permissions - 403 forbidden. All of my sites are not working now

February 22, 2015 2.6k views

Hi. My Wordpress website asked me to manually add FTP login and password to perform updates. When I was trying to configure FTP connection I accidentally messed up permissions and now all of my websites have 403 forbidden error.

Here's what I did:

root@panel:~# chmod 777 /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache
root@panel:~# chmod 777 /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/w3tc-config
root@panel:~# rm -rf /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache/config
root@panel:~# rm -rf /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache/page_enhanced
root@panel:~# setso --set sentora_domain panel.bowshrine.com
root@panel:~# setso --set apache_changed true
root@panel:~#  sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 12185
root@panel:~# sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 12357
root@panel:~# sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 12509
root@panel:~# chown root:root /var/sentora/hostdata/zadmin/public_html
root@panel:~#  sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 12618
root@panel:~# rm -rf /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache/object
root@panel:~# rm -rf /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache/db
root@panel:~# rm -rf /var/sentora/hostdata/zadmin/public_html/bowshrine_com/wp-content/cache/minify

After the last command my websites stoped working. The I probably messed up more as I tried to bring back the permissions, so I used following commands:

root@panel:~# sudo chown -R root:root: /
chown: invalid group: ‘root:root:’
root@panel:~# chown root:root /
root@panel:~# sudo service apache2 restart
 * Restarting web server apache2                                         [ OK ]
root@panel:~# sudo chown -R $USER:$USER /var/sentora/hostdata/zadmin/public_htmlroot@panel:~# ^C
root@panel:~# sudo service apache2 restart
 * Restarting web server apache2                                         [ OK ]
root@panel:~# sudo chown -R $USER:$USER /var/sentora/hostdata/zadmin/public_html/bowshrine_com
root@panel:~# ^C
root@panel:~# sudo service apache2 restart
 * Restarting web server apache2                                         [ OK ]
root@panel:~#

What should I do to restore permissions and bring back my websites?

5 comments
  • OMG!!! never change permissions on /, NEVER!

    Assuming you don't mess with the OS with is a pretty big possibility, you need to assign permissions to apache user (it maybe apache:apache), also don't do 777, try 775 or check WP site for recommended permissions.

    Backup all your sites before messing around with more permissions in case you need to use a new droplet, you know cause the "sudo chown -R root:root: /" mess.

  • @EpicCDN, I wasn't sure what I was doing. I'm just learning Ubuntu and configuring VPS. I know I messed up pretty bad. I've backed up all files and databases and destroyed droplet. I configured Ubuntu and Sentora once again from the beginning and FTP now works like a charm, which is weird because I followed the same steps. But nevertheless, it all works for now.

  • You should try using serverpilot.io it makes most of the job for you. I'm glad you could recover :D

  • @EpicCDN, I've never heard about it before. Most of the people here recommeded Sentora (or previous version known as zpanel), so I've installed it. Maybe some day I will try Server Pilot out. Thanks.

  • Servicerpilot, on my own opinion is the future of control panels for the web, is completely cloud based, you almost don't need to install a thing to use it, go read more about it, and yopu may change your mind about c/z/panels

Be the first one to answer this question.