Linux Archives

Over 80% is running on some form of Linux – so does your Mac and you iPhone. Sometimes we have to get our hands dirty on the command line – it makes you feel like a proper hacker.

Here are some pointers I picked up on my journey.

How to install EPEL and apachetop on Centos 5 and Centos 6

I wanted to use apachetop to monitor one of my servers in real time. Much like top, apachetop reads the acces_log file in /var/logs/httpd/ and displays the results as apache processes happen.

Rather than installing apachetop from source, I thought a simple command like

yum install apachetop

should to the trick… but it doesn’t work by default. Now what?

Well an install via yum will only work if it is configured to look in the right repositories. Apachetop however is not part of the standard repos, hence we need to add what’s known as the EPEL package to yum (it stands for Extra Packages for Enterprise Linux).

In this article I’ll show you how to do it and how to run apachetop.

Read more

How to show your Linux Version

Sometimes you’re working on a system and you’re not entirely sure which Linux distribution it is. There are several ways to find out what you’re working with and I keep forgetting what they commands are to get there – so here’s a quick list for all of us. Release and Distribution Most systems (but not … Read more

How to use vi to edit files in Linux

Here’s a brief reminder on how you can edit files with vi directly from the command line. Text is all you get, no other visual clues or menus are included, and best of all you need to know each keyboard shortcut once you’ve entered it.

vi is an old editor going back all the way to 1976. It’s not the most comfortable one, but the beauty is that it’s available on pretty much every distribution. There are several other common editors out there, but it’s not always an option to install those just for a quick file edit.

In this article I’ll show you the most commonly used commands and shortcuts, help you delete old versions of a file and show you a couple of links to more in-depth sources.

I assume here that you are comfortable using the command line interface (CLI).

Read more

How to use SFTP with Plesk 10.4.4

We had a discussion recently about using SFTP under Plesk 10. It’s possible, however the feature is not called SFTP explicitly so I thought it’s best to describe how it works here.

Note that SFTP is only possible for the main domain owner, not for additional FTP Users that you may create under Web Users… sorry! Here’s the Parallels Knowledgebase article which explains why.

That said, here’s how you activate SFTP for your account:

Read more

How to install CentOS with Parallels Desktop

You can never have enough servers flying around, be that for testing, playing or developing. Today I decided that I wanted my local copy of CentOS on my Mac Book Pro – and thanks to Parallels Desktop I can run this in a virtual container alongside Mac OS X. Nice!

It’s a bit complex so I took some notes – may they be useful for both you and me at some point in the future.

I’m installing CentOS 6.2 in 64bit on OS X Lion on a 13″ Mac Book Pro with 8GB of RAM and an Intel i7. I’m using Parallels Desktop 7 for this exercise.

Read more

How to prevent direct file access in your wp-content directory

I was working on a secure site with sensitive video material that we needed strict members access to. Even though many plugins can make sure your direct permalinks can only be seen by logged in members, direct links to files in your wp-content directory are still accessible to others. They can even be hotlinked from other sites.

One way around this is to move the wp-content directory outside the web visible portion of your directory on the server, but even so WordPress can always link to such files. A better way is to tell your server not to give access to certain files (say ending with mp4 or mp3) and only allow access from your own domain.

We can use Apache Mod Rewrite for this – it’s a complex language that you can utilise in your .htaccess file within the wp-content folder.

Let me show you how to keep prying eyes out of your content.

Read more