Update Python Packages (PIP)

We’ve had a run of Python packages recently and you can tell that I’m a fan because today we will discuss how to update Python packages that were installed via PIP. This should be a pretty easy article to follow along with.

Before diving into the world of installing Python packages from a centralized repository (via PIP), you should probably be familiar with the entire process. So, read these two articles before proceeding:

Install Python’s PIP Part One

And then follow up with this article:

Install Python’s PIP Part Two

It’s important to upgrade the packages you’ve installed with PIP. All software requires updates. Bugs are fixed with newer software but, more importantly, security issues are addressed with updates. This doesn’t just apply to Python. It applies to your whole computer. Software gets updated and you need to apply those updates.

So, today we’re going to do some maintenance and we’re going to update Python packages. Rather than waste time with a long intro, let’s get started!

Update Python Packages:

Just so you know, Python packages are installed in the terminal. So, it stands to reason that updates are also done in the terminal. To follow along in this article, you will need an open terminal. So, if you want to update Python packages you should start by opening a terminal. You can usually just CTRL + ALT + T to open your default terminal emulator.

With your terminal open, let’s first ensure PIP is installed with this command:

Next, make sure PIP is updated to the newest version:

With PIP upgraded to the most current version, you can check to see which Python packages you have previously installed. That’s done like this:

Now, you can see which packages can be updated to newer packages:

That will give you an output similar to this:

Now, you can update the packages, like so:

You can also do multiple packages at the same time:

By doing this, you can update your Python packages, at least those installed via PIP. That is indeed pretty easy.

However, I have a command that I certainly didn’t come up with. This is a command I found in my notes and I do not see a reference URL – or I’d cite the source. Doing some searching, I saw that this command is referenced at multiple sites. So, finding the source is problematic for me.

If you want to upgrade all the Python packages at once, try this command:

I tested this and it appears to work well enough. PIP does love to throw errors in the terminal but generally works okay. That command should update all the packages you’ve installed with PIP – including any Python dependencies that were installed at the same time.

See? It’s pretty easy to update Python packages…

Closure:

Well, now you know how to update Python packages. I figured that this was an important article to write. If you’re going to use PIP to install Python packages, you might as well know how to keep yourself secure and how to keep yourself updated. That seemed reasonable.

However, my Python skills aren’t that great. I can do a Hello World program and that’s about it. I haven’t even done that in a while. So, don’t go asking me detailed Python questions! I probably won’t have an answer. My use is pretty limited to things I can trivially install with PIP.

Also, you may not want to ask me questions. While I’ll be polite, my time is constrained these days. I’m just as likely to refer you to a forum or two. You can ask questions. If they’re good, I’ll maybe answer them in an article. I’m just pointing out that you shouldn’t expect too much from me.

“If you don’t expect too much from me, you might not be let down.”

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Remove A PDF Password

This will be a straightforward task for anyone who would like to know how to remove a PDF password in the Linux terminal. If you deal with a lot of PDFs and want to remove the password, it’s a fairly easy task. Read this to learn more!

As mentioned before, PDF stands for Portable Document Format. This is a ratified ISO standard (ISO 32000) and is an open standard. You can see a bit about the PDF standard here on the ISO website. However, unless you have a subscription, they’ll want you to pay for this. I am not paying for this as I do not need to know the specifics.

Many people think that it’s proprietary because it comes from Adobe, but it’s an open standard and there’s a bunch of software available to manipulate and create PDF files. The standard has been open since 2008 which explains the myriad choices for editors.

Seeing as you’re here, you might as well read this interesting Wikipedia article:

History of PDF

PDFs can come with different levels of security. They can have passwords that lock the ability to edit the file and they can have passwords that you need just to open the PDF file.

This article assumes that you know the password! The exercise in this article only applies if you already know the password. I did write an article about cracking a PDF password, but that can take a long time.

How To: Crack A PDF Password

So then, which tools are we going to use?

poppler:

We’ll be installing a meta package known as poppler. This may come pre-installed on your system, or you may need to install poppler manually. We’ll go over installation instructions for a variety of distros, as it’s widely packaged and available in the various distro’s default repositories.

You’ll find that poppler is a meta package. That is, it contains other packages. In this case, poppler contains other applications that are used to manipulate PDF files. There’s no such thing as man poppler for example. It’s just the package name for a package that contains other packages. (That’s a meta-package.)

If you dig into it, you’ll find that poppler contains applications like pdffonts and pdfimages. At this point, we’ve previously covered pdftotext. This time around, we’ll be using pdftops. We’ve not yet used this tool in other articles, so now is as good a time as any to learn about it.

pdftops:

This pdftop application is mostly intended to turn PDF files into PS (PostScript) files but has other uses. Sort of like how a medication can be prescribed off-label, so too can you use this tool for other things. This time around, we’ll be using the pdftops to remove a PDF password.

If you had poppler installed already and checked the man page, you’d see something that should be close to this:

pdftops – Portable Document Format (PDF) to PostScript converter (version 3.03)

We’ll be skipping that whole bit about converting it to a file formatted for PostScript. That’s not necessary for our goal – removing a password from a PDF-formatted document.

But, this tool contains the necessary commands to remove a PDF password. If the file has multiple passwords it will remove the password specified. Your best bet is to remove the password that enables editing. This will also unlock the PDF for viewing purposes.

Remove A PDF Password:

If you want to remove a PDF password, you can use a GUI tool and then choose the ‘export’ option – or maybe the ‘save as’ option. In our case, and as mentioned above, we’ll be using the terminal to remove a PDF password. If you don’t know how to open a terminal, that’s usually accomplished by finding the application in your menu or by pressing CTRL + ALT + T on your keyboard.

With your terminal now open, we need to install the poppler meta package. I’ll include the commands as I understand them but you may need to doublecheck my work. Depending on your package manager, try the following:

Debian/Ubuntu/etc:

RHEL/CentOS/etc:

OpenSUSE/SUSE/etc:

Gentoo:

Arch/Manjaro/etc:

One of those should work with all the major distros out there. If you’re using an obscure distro with an obscure package manager, the poppler utilities should be available to you. You’ll just need to edit your installation command to match your package manager.

Also, if you do need to do that, please let me know. If you let me know, I can include the command in the article, thereby making the article more useful to more people. One of my primary goals is to be useful. It’s good to be useful to more people.

On to the meat of the article:

Removing A PDF Password:

As you’ve already got your terminal open, you might as well keep that terminal open. The application we’re using is pdftops and you can use the following command to ensure that pdftops is properly installed:

The output should look similar to this:

While you’re there, you can check the man page. There are many options available for the pdftops command and you can check them with this command:

Now that we’ve checked the man page, we’re looking for the -upw flag. That’s the flag that’s going to do the heavy lifting and the man page describes it like so:

Specify the user password for the PDF file.

So, you can see where this is going…

The syntax is quite simple. It will look like this:

If you want to specify the owner password, you use the -opw flag. You can pick which password it is that you’re using and the output file will not have that password. Specifying this flag will remove all restrictions, of course.

Let’s try to give you an example…

I wrote an article about how to crack a PDF password and I included a link. For the sake of clarity, you can now download that PDF file.

Example PDF File

The password for that file is ‘abab’ and not one of you took the time to crack it. I made it nice and simple for you, but not one of you took the time to crack the password.

Still, we can use that in our example:

Rather than converting to PostScript, we are just opening and unlocking the file. At that point, we’re redirecting that unlocked content to a new PDF file. In the process, we’re stripping the existing password, meaning you can easily access the file in the future – even if you’ve long since forgotten the password.

Closure:

I’m not sure how often you work with PDF files, but this might be something you can use. You don’t need to remember complex passwords unless you want to. Very few people are interested in maintaining a mental list of all the passwords they use.

It’s not like there’s a password manager for PDF files (as far as I know). You’re stuck referencing the original place the password was shared or keeping some sort of list. Well, you do have another choice. You can learn how to remove a PDF password in the Linux terminal and be done with it. It’s up to you.

Anyhow, I figured this would make a good article. I don’t mention PDFs often and don’t write many articles on the PDF subject. There have been a few of them but there’s always more to cover. Today we just covered how to remove a PDF password. Maybe we’ll cover something else in the next article – but I’m more likely to skip a few articles so that it’s not just PDF content for a week.

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

Seeing as you’re here, why not visit our friends at Blunix?

Here’s why you might just want to visit Blunix:

“Blunix GmbH offers Debian and Ubuntu focussed Linux Emergency Support 24/7, Project-based Linux Consulting, FOSS-based Managed Hosting on your company IaaS provider account as well as custom Training and Workshops. We prioritize fair business partnerships and employee quality of life over profit. We focus on reasonable security by default and encourage your employees and developers to keep things secure enough to avoid 99% of security issues with automated attack vectors. We focus exclusively on this and do partner with other companies to refer customers that do not fit exactly what we do, or where we require additional help (for example we have a security-focused company that we partner with for higher risk factor hosting setups).”

Click to visit Blunix GmbH

How To: Crack A PDF Password

I don’t know how handy today’s article is going to be in reality but it’s sort of possible to crack a PDF password. Once you read the article, you’ll see why I said “sort of possible”. The odds of success will vary greatly.

Everybody knows what a PDF file is. It’s a Portable Document Format. This is actually a standard (ISO 32000). You don’t need Adobe products to create, edit, or read PDF-formatted documents. Odds are good that your distro comes with tools for manipulating PDF documents.

It’s possible to password-protect a PDF document. You can have an owner’s password (allowing editing) or you can have a user’s password (allowing you to read the document). This may be something you’ve encountered in the past.

Well, like all things password-protected, it’s possible to crack the password.

What do I mean by crack? I mean it will reveal the password to you in plain text. This will allow you to access the document in one form or another, depending on which password you crack.

This is gonna take some time…

Also, I’ll assume you’re using something based on Debian because I’ve not tested this with other distros. I’ve only tested this on my systems.

The tool we’ll be using is a ‘brute-force’ password cracker. That means it starts from the letter a and works its way up, adding new letters after the rest of the letters have been tried. So, you’ll see aa, ab, ac, ad, and progression along those lines. You can immediately see why this is going to take a while.

The tool we’ll be using is helpfully called ‘pdfcrack’.

pdfcrack:

This pdfcrack is a terminal-based PDF password-cracking tool. You can use brute force or lists of words such as common passwords. You can also specify the character list, though the default is to just use the regular alphabet in both uppercase and lowercase formats.

The pdfcrack application is helpfully described as such:

pdfcrack – Password recovery tool for PDF-files

I’ll assume that you’re only trying to recover passwords on documents you should legally have access to. I assume that you won’t use this to access content that does not belong to you. That seems like a safe assumption!

As you can see, this is the correct tool if you want to crack a PDF password.

Crack A PDF Password:

As mentioned above, you’ll crack passwords in the terminal. That requires an open terminal, so we might as well install pdfcrack in the terminal. Just press CTRL + ALT + T and that will usually open up a terminal for you.

With your terminal now open, install pdfcrack:

With that installed, check the man page:

Download:

Example PDF File

Now, crack it…

As it’s a download, it’s probably in your ~/Downloads directory, but mine is stored in my ~/Documents directory because it’s a document. So, my example:

That uses a very simple password that should be cracked in a few seconds. On my older and slower computer, I was able to do more than 20,000 words per second. This short password should crack almost instantly.

Leave a comment telling me what the password is!

By default, pdfcrack will crack the user password. You can specify which password you wish to crack. Though the syntax is a little wonky. In this case, the syntax is as follows:

Which translates into the following…

For the owner:

For the user:

If you want to pause this, you can! 

To pause a running pdfcrack instance just press CTRL + C. This will save the progress as savedstate.sav. The program will automatically resume when you run the command again. Pretty neat!

There’s a lot you can do with this command. Let’s say you recall the password was between 8 and 12 characters and want to just search in that area.

You can also specify the character set. If you want to use uppercase, lowercase, and numbers you can do that. You just add them to the command with the -c flag, making sure to put them in quotes. That’d look like this:

You can specify a wordlist like so:

The format for that file appears to require one word per line and there are collections of common passwords you can download to help you crack a PDF password.

As you can imagine, and as you were warned near the start, this process can take a while. Assuming you have the right characters loaded and enough time, it’s certain to work eventually.

Go ahead and crack my example file above. That one won’t take you very long, even on a slow computer. It won’t be instantaneous, but it’ll be pretty quick.

If you want, you can also run a benchmark to see how fast your computer is. The command to do that is quite simply this:

I ran this on the slowest computer I use. I didn’t run it on anything faster because I don’t care that much. I’m sure you’ll do better on your computers, though you can share the results as a way to compare your rig with others.

Anyhow, my output was this:

Be sure to check out the man page. It’s a simple application but there are many options available for pdfcrack and you might as well learn about them now. You never know when you’ll find an old PDF document with a forgotten password. It can (and does) happen!

Also, be sure to check the pdfcrack project page.

Closure:

So, you might wonder why I’d include an article like this. After all, isn’t cracking passwords a potential legal mess? Isn’t it immoral to crack passwords? Is it even legal to crack passwords?

The answer is simple enough. It’s a tool you can use to recover your lost passwords. You can use this tool to access things that you shouldn’t be accessing, just like you can use a screwdriver to poke things you shouldn’t be poking. I’m just giving information.

I am also not a lawyer. I permit you to crack the password of the included file. For other files, don’t do anything illegal in your jurisdiction. If it’s a crime, don’t do it. I’m decidedly not your lawyer. If you think this requires asking a lawyer, go ahead and do so.

That and it’s not a great secret. If you’re relying on a password to protect PDF files from anyone serious, you’re probably doing your security wrong. It’s well known that this is possible and that the tools are easily installed. PDF passwords aren’t very good for security, though you can make complicated passwords.

The distro you’re using may very well have pdfcrack available, even if it isn’t one of the Debian-based distros. Just search and you can find it. With some work, you can even mostly install it with PIP. Just click the link above to the project page for more information about that.

As always…

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Set Individual Flatpaks Permissions With Flatseal

This will be an article about Flatpaks permissions and how you can set said Flatpaks permissions with Flatseal. There’s a good chance that this will be a relatively short article, which is nice.

BEFORE YOU BEGIN:

I covered what a Flatpak is and some other bits of information. Read this:

Install Flatpaks In Lubuntu

That will give you an overview and enough information to get started. The only thing that will change is how you enable Flatpak and the Flathub repository. The method you use to do that will be different unless you’re using a distro that relies on the apt package manager.

What Is Flatpak:

I wrote this information out already, but some of you will not bother clicking immediately so I’ll mention that a Flatpak is an application that runs with its own dependencies and is sandboxed from the rest of the system.

The important part of this is that the developers who packaged the Flatpak set the permissions for that application. For example, their application may need access to the network. Their application may need access to storage media. The Flatpak may need to be able to access the sound manager so that you can hear things output by the application.

Well, you can adjust those permissions. If you want to grant additional access, you can do that. If you don’t need certain features, you can deny access to those resources. It’s up to you.

The developer shipped the Flatpak with a set of permissions. There are also default permissions that you can edit. If you want to do something like disallow all Flatpak access to the network,  you could do that. You can also adjust these permissions on a per-application basis.

Which leads us to this…

Set Flatpaks permissions with Flatseal:

If you want to manage Flatpaks permissions with Flatseal, you can start (and pretty much close this page) with the following link:

Flatseal on Flathub

The installation instructions will be available on that page. Alternatively, if you’ve already enabled Flatpaks (see the earlier link in this article) you can just press CTRL + ALT + T to open your terminal and enter the following command:

After you enter that into your terminal, you’ll press the Y button on your keyboard a couple of times to confirm that you wish to install.

With that said and done, you can then open your application menu, find Flatseal, and open the application. I’ll give you a screenshot, but there’s just so much more to this application that I can’t cover it. It’s fairly self-explanatory and you should be able to figure it out – but there are many options. 

Flatseal is used to adjust the permissions of a Flatpak.
That’s just the tip of the iceberg. Scroll down and there are maybe 50 options. Good luck!

There are just too many options for me to cover. The best way for you to learn how to use Flatseal is to simply install Flatseal and examine the options. If you have any questions about those options, reach out and I may be able to help. Otherwise, you can figure this out on your own.

I have faith in you. You can figure this one out!

Closure:

Well, you can now adjust Flatpaks permissions with Flatseal. I’m never quite sure how to pluralize or make it possessive, but I did my best. We’ll have to see how the final article does.

Anyhow, I told you this should be a fairly short article. It’s not designated as a short article because it’s a bit long for that and you have to read a bunch of other stuff if you want to use this as your starting point. If I could assume you had Flatpaks already enabled, this could have been a short article. I’ll make no such assumptions.

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