How To: Add A PPA To Ubuntu

In this article, we’re going to discuss how to add a PPA to Ubuntu. A PPA is a Personal Package Archive, but we’ve come to use them much differently than they were ever intended. So, you might as well learn how to do this. You might as well learn how to add a PPA to Ubuntu.

Yes, we use PPAs in ways never intended. They are meant to be your own personal archive of packages. not a way of disseminating software to the masses. We’ve turned PPAs into a tool to widely distribute software more easily. If you want a piece of software that’s not in the official repositories, you do a quick search, add a PPA, update, and install your software! It’s how we’ve always done things! (Hint: No, it’s not how we’ve always done things.)

This is one of the main reasons Snap apps were created and why they are being pushed. During this time, people could also have used AppImages and Flatpaks, and some of us did.

Me? I’m among the worst of offenders. As it is, I still only use Snaps that came installed by default. I still reach for a PPA (when available) and install things in the ‘traditional’ manner. Well, it’s hardly traditional and it’s generally a bad idea.

In fact. let me sum up why it’s a bad idea with just one sentence…

When you add a PPA, you’re giving the PPA maintainer root-level access to your computer.

All they gotta do is push an update and you’ll have installed it with your next upgrade. No, don’t pretend you’re going to read the source and verify the integrity. You’re going to do it, just like you wanted to …

Add A PPA To Ubuntu:

Alright, let’s paint a simple picture:

There’s some software you want, but you can’t find it in your repositories and the GitHub page doesn’t release packaged binaries. You don’t want to have to deal with building it every time there’s a new version, so you take to the ‘nets in search of a fix.

Your first stop is at Launchpad.net to search for the application. You got lucky and found a PPA. In fact, you found a few of them. In this case, you want to look for the one who has most consistently published upgrades. First, you have to enable Ubuntu’s ‘universe’ PPA, which may already be enabled. If it isn’t, the command to run is:

When you find the proper repository’s name, you can add it with this command:

An example of that could be sudo add-apt-repository ppa:mozillateam/ppa. You could use that to use the more traditional Firefox. 

No matter… Once you’ve done all this,  you might still need to update your own local software database with this command:

There you have it. You can now add a PPA to Ubuntu. You can now use the software included in the newly added PPA. Modern/current Ubuntu flavors will run the apt update automatically, but older versions will still need to trigger the update manually.

BONUS: You can more easily remove the PPA through the GUI, but you can also do so in the terminal, it’s just the –remove flag, like this;

See? You can now do both. You can add a PPA to Ubuntu or you can remove a PPA from Ubuntu.

Closure:

Ah well… You can now add a PPA to Ubuntu. Removing a PPA is also now something you can do, assuming you didn’t already do so. On top of that, adding PPAs willy-nilly as  you’re essentially giving that PPA’s owner a key to your entire computer.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Check Your SSH Server Configuration

Today, I’m going to show you how to check your SSH server configuration. It’s a simple process, but not one many people seem to know about. It’s also a pretty handy tool if you’re having SSH issues. Once again, this one isn’t all that complicated, I think… Read on!

So, why would you want to check your SSH server configuration?

Your SSH server might not be working. You may have made some changes and want to test it before moving it to production. An upgrade to the SSH application may have made some of the options different or even removed the options entirely.

There are all sorts of reasons why you’d want to check your SSH server configuration. Those are just a few of them. Not only will the article show you how to check your SSH configuration files – it’ll show you how to test alternative configurations. So, you can test your changes before making them – potentially saving you a physical trip to the server.

Check Your SSH Server Configuration:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

By the way, I would test/learn this on a local system. You’re potentially going to break things. In fact, let’s start by breaking them! Well, let’s create a backup first, and then we’ll break stuff.

Okay. Now let’s break something! Run this command:

Find a line that has a command and doesn’t start with a #. You can also remove the # from an option and it’ll be work. Find a one line option that has a “no” option field and change it to “oh_no” *sans quotes, though that probably won’t matter) and then save the file. 

(Also, to save the file in nano, press CTRL + X, then Y, and then ENTER and that should do it.)

Now, let’s check that SSH server configuration with the following command:

If things go according to plan, it will tell you that you have an error. On top of that, it will tell you on which line you have the error. If it doesn’t throw an error, it means your configuration is fine – or that you may need to restart your SSH service for it to see the new configuration.

If you do somehow need to restart SSH server (you shouldn’t have to), restart it with the following command:

Run the command again and that should definitely show the error, which you can easily fix by simply undoing what you did in the steps above and saving it. You almost certainly shouldn’t need to restart SSH to show the error, though you may want to restart it after you’re done playing around in the config file. Of course, if you did have to restart the SSH server, you’ll need to do so again after fixing the error you intentionally introduced.

BONUS: If you want, you can list the path and check a configuration file that’s not actually in use. So, you can check the configuration file before putting it into production. That’s just:

Again, under normal circumstances, it won’t show any output if it finds no errors. It only outputs information if there’s actually an error. So, a null response is considered normal and good.

Closure:

See? Nice and easy. Now you can check your SSH server configuration for errors – even doing so before putting the config into production. It’s a pretty handy tool to have. Also, you’ll need SSH installed and running on the machine you’ll be testing with. I figure that’s obvious, but I better mention it somewhere or someone will point it out or ask about it. Then again, people seldom read this far down in an article.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Check A Disk For Errors

In today’s article, we’re going to learn how to check a disk for errors. We’ll be using a multi-pronged process to thoroughly check a disk for errors in the Linux terminal. By itself, none of these are particularly complicated. As such, I expect this to be a relatively easy article to follow.

If you’ve been seeing errors when transferring data to a disk, it’s probably a good sign that it’s time to check that disk for errors. You may also want to check a disk for errors if you’ve not used it before – like if it is used or if you have just purchased it.

To perform these tests, the disk must not be mounted! If need be, you’ll have to do these tests from a live environment. That’s easy enough. Remember how you installed Linux? Well, that same installation media is (usually) the same media you’ll need to enter a live environment. You will, of course, need to boot to the media when you start your system – be it USB, or CD, or DVD. It’s much the same as though you were going to install Linux – except you don’t opt to do the installation – you just work in the live environment.

Anyhow, we’ll be using a few tools for this. All of these tools will almost certainly be available by default. If they’re not, ummm… Well, if they’re not, pick a different distro’s live environment to use, or install them yourself! These tools are all on the installation media for distros in the Ubuntu family, for example. So, yeah, find a distro where they are available – which should be pretty much all of them.

Check A Disk For Errors:

So, you’re booted to a live instance of your favorite distro (or the disk you’re going to check is unmounted) and you’re ready to start testing. Well, you need an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have your terminal open, use lsblk to identify the disk you wish to check for errors. For the purposes of this exercise, we’re going to assume the disk you’re checking for errors is known as ‘sda’. Be sure to change that to suit your particular needs.

First, let’s check for S.M.A.R.T. errors (which we’ve previously covered in-depth). You can do so with this command:

Next, let’s check for bad blocks. Bad blocks are physical points on your device that no longer work properly. Some bad blocks isn’t, necessarily, indicative of immediate disk failure. Some bad blocks may be normal. Still, let’s check it.

If you’re really into this, you’ll want to check it for bad blocks – and then check it again soon after. That will let you know if the number of bad blocks is increasing. If the number is rapidly increasing, disk failure will likely soon follow. Otherwise, you’re probably okay for the time being.

Finally, let’s check for file-system consistency. This is typically done with the ‘fsck’ command, a command you should have some understanding of. There are many ways to run the command, but you can just use the following command to see what’s going on:

Now, you’ve run three tests. Between them all, you should have a pretty good understanding of your disk’s health and you’ll know how to check a disk for errors. Again, you’ll want to check a disk for errors when the situation dictates – especially if you’re getting disk errors while in the operating system. 

When you get disk errors, it’s time to consider retiring the drive. Depending on the severity of the errors, you might wish to stop using the drive immediately, creating an image of the drive, and retiring the drive from your system. Disk failures happen and recovering data from a failed drive can be a major hassle. So, use these warnings as a reason to consider replacing your drives if drive failure is in the cards.

Closure:

And there you have it! You now know how to check a disk for errors! It’s a handy skill to have. After all, disks fail. Knowing when they are going to fail is a good thing. Being prepared for disk failure is a bonus and a good idea! It’s also worth checking new disks. I’ve tested new disks and had unsatisfactory results that meant I returned the disk to the retailer, so it’s a concern and worth taking the time to test.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Zip A Directory In The Linux Terminal

Today, we’re going to zip a directory in the Linux terminal. This isn’t a very complicated task, but it’s worth covering. It’s also not something you’re likely to do every day, but it’s bound to be useful to some of you. You’re eventually going to want to share a directory’s worth of files with someone!

Why zip a directory? This is Linux, we deal with .tar.gz!

Well, in the real world, you might just want to share files with other people. They’ll have no idea what to do with a .tar.gz file – but they’ll know exactly what to do with a .zip file.

More importantly, pretty much every operating system on the planet can open a .zip file. Even way back with the Amiga and Atari systems, you were able  to open .zip files.

As an added bonus, you probably already have the utility to compress files into .zip files and won’t need to install anything! So, you won’t need to install anything and you’ll be able to share the resulting files with pretty much anyone on the planet. What’s not to love?

Heck, you don’t even need to install an application on Windows or MacOS to open .zip files. As a quick test, I can even open them with a file management application on Android. I’m not sure if Android also deals with them by default or if it’s a function of the file manager. Still, you can open .zip files just fine on Android.

With all those great things, you might just as well learn how to zip a directory in the Linux terminal. I promise, it’s really easy.

Zip A Directory:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Chances are very good that you won’t have to install ‘zip’ to get this to work. You can find out quickly enough by just typing:

That’ll likely tell you which zip and where it’s located. If not, you’ll need to install it from your default repositories. I expect very few people will need to do that.

Now to zip a directory…

You can also zip a directory recursively, by using the ‘r’ flag:

This is not to be confused with the R flag, which will recursively compress the files in the folder – but only those files that were specified, such as from this example command in the man page:

That’d take all the files in the current directory that ended in ‘.c’ and compress them into a file called foo. That’s not really what we’re after, nor is it what the article is about. Either way, while you’re exploring, be sure to check the man page. This is one of the biggest man pages you’ll likely come across and there are a ton of options beyond just simply letting you zip a directory.

Closure:

There you have it. You can now zip a directory – such as a directory of pictures to share with your loved ones who are still not using Linux. It’s not terribly difficult, but it’s a useful skill to have and you never know when you’ll want to share a bunch of files with other people.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Stop People From Viewing Files In A Directory With .htaccess

If you have a website, then you will have directories and you might want to stop people from viewing files in a directory. You might want to do this for privacy reasons, or for security reasons. So, if you’re looking to stop people from viewing files in a directory with .htaccess, you’ve come to the right article.

By using the .htaccess method to stop people from viewing files in a directory, people will still be able to see linked files in the directory – they just won’t be able to browse the directory to find unknown files. It’s like the best of both worlds. They can see what you’ve shared, but (unless guessing URLs) can only see what you’ve shared and nothing else.

It’s a handy tool to use and basic security (and privacy) step to prevent snooping around your server – assuming .htaccess is an option. Of course, if you’re just spinning up a quick Python server, it’s not going to be of much help.

Anyhow, this will be a relatively short and easy article, and only applicable to a subset of the site’s visitors. I want to cover more server articles, so we might as well take this one from the previous site and migrate it to this one. 

Stop People From Viewing Files In A Directory:

Open the directory you want to keep private with your favorite FTP client – unless you’re doing this on a local computer. If that’s the case, you can just navigate to the directory.

Create a new file called .htaccess. The ‘.’ is important and mandatory, as it’s a hidden file. If the file already exists, now would be a good time to make a backup.

The permissions for .htaccess should be 644. Your FTP client will let you set permissions. Locally, you can chmod 644 .htaccess and that should work nicely.

Next, you’ll want to edit the .htaccess file with a plain-text editor to add the following line (if the file already exists, be sure to put this on its own line):

Save the .htaccess file. Be sure not to modify any other lines in the process. There’s a whole lot that can be accomplished using .htaccess and it can be pretty complicated.

What this will do is prevent indexing the files in that particular folder. If people try to access the folder directly, they’ll get a 403 forbidden error. At the same time, you can still link directly to files in that folder.

So, let’s say you added the .htaccess to a directory called /tmp. You can still link to, use, and send people to /tmp/picture.jpg like normal, but people won’t be able to browse the directory and find files you don’t want them to see. They won’t be able to browse the directory to see that you’ve also uploaded picture2.jpg to the same directory.

For more information, you can click this. (I wasn’t kidding when I said it could get complicated.)

Closure:

Thanks for reading today’s article. Today, we learned how to stop people from viewing the files in a directory – unless you let them know the URL, of course. It’s a pretty handy skill to have, as is basic editing of the .htaccess file.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.