Too often, new customers can get overwhelmed by a small administrative task on a Linux server. One of the more common questions I see in technical support is when a drive partition runs out of space. The website appears offline, and on of my coworkers advises you to just free-up some space. "Just?! Where can I find files that are deletable without affecting my website?"
Don't worry ... it's really quit simple. If you can use FTP (File Transfer Protocol), you can handle this bit of server management. Depending on the exact problem, we might instruct you to free up space by removing files in one of the following directories:
The reason these directories are usually overlooked is because they are not accessible by normal FTP users — users who only upload website content. When you upload website content to the server via FTP, the FTP user is limited to the directory structure for that website. Directories starting with "
/var" and "
/usr" cannot be accessed by these non-root users (The "root" user can access anything). And while root is a powerful user, for the sake of security, it is not normally allowed to log in over FTP because FTP is not secure ... That's where SFTP (Secure File Transfer Protocol) comes in.
Most FTP clients support SFTP, so you don't have to learn a new environment to securely access any file on the server. Every FTP client is different, but I'll illustrate with FileZilla because it's free and available on Mac, Windows and Linux. If you don't already have an FTP client, I highly recommend FileZilla. Because there are a few ways to use FileZilla to get an SFTP connection, I can share different options for you to try:
The Quick Connect bar is the quickest way to connect to your server. Start FileZilla and look immediately under the toolbar for the Quick Connect bar:
Enter the hostname (IP address or domain name), “root” in the Username field, the root password in the Password field, and “22″ in the port field. Remember, port 22 is for SFTP, the same as SSH. Click the Quickconnect button to connect.
Using the Site Manager
The Site Manager lets you save your login details. Start FileZilla and you'll see the following:
To open the Site Manager, click the left-most icon in tool bar or go to
File >> Site Manager in the menu.
Enter an IP address or domain name for your server in the Host field, and select "SFTP" as your protocol. You'll enter the root user's login information, and you're ready to connect by clicking the "Connect" button or you can click the "OK" button to save and close the dialog box.
If you just saved your settings and the Site Manager is not open, click the Site Manager icon again. From there, you can select the site under the "Select Entry" box, and you just have to click "Connect" to initiate the SFTP connection with your saved settings.
If you see a pop-up that warns of an "Unknown host key," clicking the "Always trust this host, add this key to the cache" option will prevent this interruption from showing in the future. Once you click "OK" to complete the connection, your FileZilla screen should look like this:
Notice the "Remote site" section on the middle right of the FileZilla screen:
This area in FileZilla is the directory and file listing of the server. Navigate the server's file structure here, and click "
/" to access the top of the folder structure. You should see the "
/usr" and "
/var" directories, and you can explore the filesystem to delete the files technical support recommended to create space!
If you have a problem connecting to your server by FTP or SFTP, the open area below the Quickconnect bar is the Message Log. If you can copy and paste this text into a ticket, you'll help technical support troubleshoot your connection problems. Below is an example log of a successful FTP session:
Status: Connecting to server.example.com... Response: fzSftp started Command: open "firstname.lastname@example.org" 22 Command: Trust new Hostkey: Once Command: Pass: ********** Status: Connected to server.example.com Status: Retrieving directory listing... Command: pwd Response: Current directory is: "/root" Command: ls Status: Listing directory /root Status: Calculating timezone offset of server... Command: mtime ".lesshst" Response: 1326387703 Status: Timezone offsets: Server: -21600 seconds. Local: -21600 seconds. Difference: 0 seconds. Status: Directory listing successful
And here's an example of a failed connection:
Status: Resolving address of example.com Status: Connecting to 126.96.36.199:21... Error: Connection timed out Error: Could not connect to server Status: Waiting to retry... Status: Resolving address of example.com Status: Connecting to 188.8.131.52:21... Error: Connection attempt interrupted by user
If you have any questions, leave them in a comment below. Enjoy your new-found SFTP powers!