Coder Social home page Coder Social logo

trobotham / cpanel-fixperms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peachflame/cpanel-fixperms

0.0 1.0 0.0 177 KB

A script to fix permissions & ownership, on files & directories, for cPanel accounts.

License: GNU General Public License v3.0

Shell 100.00%

cpanel-fixperms's Introduction

cPanel-fixperms

A script to fix permissions and ownership, on files and directories, for cPanel accounts.

More Info

Ever needed just to quickly 'fix' the permissions or ownership for your files in a regular cPanel account? This is the script for you. There is a staggering number of people using cPanel out there, and this script will help every cPanel user quickly recover from self-made permission mistakes or allow you to be lazy when setting permissions when uploading new scripts (ex: Wordpress).

It safely steps through the file structure only in a particular user, and sets folders to be owned by the user, and files to have cPanel-recommended permissions.

It is safe to run, and I would run it in a heart-beat as a general 'fix my errors' fix.

For those running multiple attached volumes on their servers, such as multiple home directories with cPanel (eg., /home, /home2, /home3, etc), Will Ashworth has updated the script to figure out the user's true home directory, and the script will repair permissions as needed for that user(s). This is a rather new change, so please let us know in the comments if you experience any weird issues. However, we've tested this and it does appear to be working fine (hasn't broken anything yet!).

Note: This is inteded for non-DSO servers (ex: FastCGI, suPHP, etc...). You CAN run this on a DSO box, but just know that things such as Wordpress uploads won't work. You'll have to manually set some folders to be owned by the user "nobody".

Instructions

You can read more info on my site here: http://boomshadow.net/tech/fixes/fixperms-script/

Fixperms - for one single user

To get the fixperms script, simply wget the file from GitHub and make sure it's executable:

wget https://raw.githubusercontent.com/PeachFlame/cPanel-fixperms/master/fixperms.sh
chmod +x fixperms.sh

Then, run it (with ROOT permissions) while using the 'a' flag to specify a particular cPanel user:

sudo sh ./fixperms.sh -a USER-NAME

It does not matter which directory you are in when you run fixperms. You can be in the user’s home directory, the server root, etc... The script will not affect anything outside of the particular user’s home folder.

Fixperms - for all of the users

If you would like fix the permissions for every user on your cPanel server, simply use the '-all' option:

sudo sh ./fixperms.sh -all

Verbosity of Fixperms

By default, the script runs in a 'quiet' mode with minimal display. However, if you’re like me, you may want to see everything that is happening. You can turn on verbosity and have the script print to the screen everything that is being changed. I find this extremely useful when fixing large accounts that have many files. You can watch the changes as a sort of 'progress bar' of completion. The '-v' option can be used per account or with all accounts.

For one single account

sudo sh ./fixperms.sh -v -a USER-NAME

For all accounts

sudo sh ./fixperms.sh -v -all

Getting Help

You can run fixperms with the '-h' or '--help' flags in order to see a help menu.

You can also open an issue here on GitHub or post a comment on my original blog post: http://boomshadow.net/tech/fixes/fixperms-script/

Adding Fixperms to your bin

I host numerous websites for friends and family, who will routinely make mistakes in regards to file permissions. It's understandable; they're not tech people. I will need to fix their permissions for them pretty frequently on my servers so I opted to put the fixperms script in all my servers' bin folders.

sudo mv fixperms.sh /usr/bin/

History

This script is the spiritual recreation of a cPanel 'fixperms' script originally written by my good friend, Dean Freeman. It was something he developed while we were working together doing tech support at a web hosting company.

The fixperms script was so helpful, I wanted to share it with the world. It had been many years since the first version was written, so it needed some updating. I contracted my other friend, Colin R., to help me rewrite it for the masses, with Dean's blessing.

Colin is a beast and a "pirate" when it comes to coding, and I thank him for everything he did. This newest rendition was developed while we were both working tech support at a different hosting company: ServInt.

cpanel-fixperms's People

Contributors

boomshadow avatar ashworthconsulting avatar

Watchers

Terrance Robotham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.