Recently, we began migrating some of our clients to a new dedicated-virtual server hosted by MediaTemple. Unlike most other servers and the grid-server (GS) service also provided by MediaTemple, the dedicated-virtual server doesn’t allow much file write access by default.
Secure Shell (SSH) is a network protocol for secure data communication and command execution for unsecure networks. Since MediaTemple’s dedicated-virtual servers are technically unsecure in the traditional sense, MediaTemple removes the permissions that allow programmers to alter server-level files through standard FTP protocols.
In order for us to allow our programs to automatically create and alter files, we must override the default settings and grant the appropriate permissions.
While SSH is handled through command-line, it cannot be done through traditional means. It requires an assist-program that allows for specific SSH connections. I recommend using PuTTy. You can download PuTTy here.
Once you’ve downloaded and installed PuTTy, run the program and you’ll be prompted with this screen:
From here, enter your hostname and click the “Open” button. You will now be prompted with a command-line screen asking for your username. Enter your “root” or whatever your root username is and press enter. When it prompts for password, enter the root user password. If the program closes, then you entered incorrect credentials. If not, you will see something similar to this:
Now we need to adjust some settings in our server before we can make the actual permission change. Enter the following:
To prevent any accidental changes from crashing your server, make a backup of your group file by typing:
cp /etc/group /etc/group.BAK
Now we can really begin. Use the “vi” protocol to open your group file to change overall server permissions:
This should load the contents of the folder into the command-line. Use your arrow keys and find these lines:
and change them to read:
‘domainuser’ is the primary username you use to FTP into your site.
There are special key-functions you must press to alter data. The main keys you will use are:
Now we have to write group permissions for the folders that you would like to be writable. Enter the following:
chmod -R g+w /var/www/vhosts/example.com/httpdocs/wp-content
chmod g+w /var/www/vhosts/example.com/httpdocs/.htaccess
‘example.com’ is your domain.
You can do this by entering the following in the PuTTy command-line:
Your problems should be solved. To test if it worked, try to upload some type of media to the server via a program like WordPress. You can also try modifying your permalink structure or trying some custom PHP code that interacts with the server’s directory system.
If you run into anymore problems, be sure to let me know in the comment section. I will be happy to help you out.