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 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

How to avoid emails from Dr. Web

Dr. Web is a Russian anti-virus utility that comes bundled with Plesk. It’s good and it tries to keep the bad guys out.

To keep up with all the mutations out there it tries to update itself frequently. B default, Plesk sends the system admin an email when this happens – no matter if Dr. Web was successful or if there was a problem.

This is what a sample email looks like:

/etc/cron.daily/drweb-update:

Dr.Web update details:
Update server: http://update.us1.drweb.com/plesk/700/unix
Update has begun at Thu May 17 03:37:07 2011
Update has finished at Thu May 17 03:38:16 2011

Following files have been updated:
	/var/drweb/bases/drwdaily.vdb
	/var/drweb/bases/drwtoday.vdb
	/var/drweb/bases/dwmtoday.vdb
	/var/drweb/bases/dwntoday.vdb
	/var/drweb/bases/dwrtoday.vdb
	/var/drweb/bases/timestamp
	/var/drweb/updates/timestamp

Multiply that email by the number of servers you’re looking after, and you’ll soon have an overflowing inbox.

Here’s the solution: tweak a system file and divert those emails to nowhere.

Read more

How to install OSSEC HIDS on CentOS 6 and 7

Remote computers are under constant attack by Evil Dudes – that’s especially true for Linux servers. To prevent such attacks by Evil Dudes from Hacker Land, I’ve been relying on the amazing OSSEC Host Intrusion Detection System on all my machines.

Even though the OSSEC website is great, I always forget the simple steps that are involved in getting it up and running on a brand new server. Here are the steps that work for me.

I’ve originally written this article in 2011 for OSSEC 2.6, but I’ve just updated and tested the instructions again with OSSEC 2.8.1 on CentOS 7. It’s my go-to guide on how to get OSSEC up and running. However, by the time you read this it may all be completely out of date – please bear that in mind. Thanks 😉

Read more

How to amend an Application Vault Repository in Plesk

I’m currently building a WordPress Hosting Service where customers get hosting with WordPress pre-installed.

I also want to offer several pre-installed Themes and Plugins that I’ll deploy from the Plesk Back End using Application Vault.

WordPress is already available as a free repository, however it does take some time for new versions to be made available – and of course my Themes and Plugins aren’t there either.

So how can I amend or build a new Plesk Application Vault repository? Let’s find out in this article, in which I’m describing all my findings 😉

Read more