How To: Use sudo Without A Password

It is possible to use sudo without a password. Doing so is probably a pretty bad idea for most people, but it can be done. Password-less sudo is an option that you have, but it’s one heck of a security risk.

I have pretty good physical security and the risks of someone physically accessing my devices are pretty minimal. There’s no neighbors that can access my WiFi, or anything like that. Because of this, I can, and sometimes do, set up my computers so that I don’t need to use a password when I use sudo.

I feel like I need to make this clear:

If you set it up to use sudo without a password, you’re removing a key security element. If you can use sudo without a password, so can’t someone who’d be doing so with malice aforethought. It’d be even more risky if you did this on a laptop that might get misplaced or stolen.

In short: DO NOT DO THIS (without considering the security implications).

By the way, if you don’t know what sudo is, it stands for “superuser do”. It’s what you use to temporarily elevate your permissions, to read, write, or execute administrative (or otherwise restricted) files. Basically, it turns you into an omnipotent administrator. 

Again, be careful before doing this. If it makes you an omnipotent user, it makes anyone that can access the device an omnipotent user. You have been warned. If you’re comfortable with your physical security, this is an option. It’s an option you should consider only with care and diligence. 

SUDO Without A Password:

     See Also: Generate Complex Passwords

Like so many things, this too starts in the terminal. As always, you can open your terminal with your keyboard, just press CTRL + ALT + T and your default terminal should open. Once it is open, enter the following to open the file with nano:

Arrow button yourself down to the bottom and add the following line:

Where it says “<your_username>” you change it to your username – without the brackets. So, if your username were the same as mine, you’d make a line that looks like:

The ‘kgiii’ is lowercase, and your username will be lowercase. If, for some reason, you don’t actually know your username, you can find it with:

Anyhow, after you’ve added that line, you can save the file. As we’re using nano, you save it by pressing CTRL + X, then Y, and then ENTER

That should get you sorted and you should now be able to use sudo without a password. If you are aware of the security implications, this may just be something you want to do. On the other hand, it’s not exactly taxing to type your password.

Closure:

And, once again, you have another article! I’ve reached the point where I have a small buffer. I could be offline for a few days and articles will still publish themselves. I’m hoping to get even further ahead, so we shall see how it goes.

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: List All Users In Linux

If you want to list all users in Linux, this is the article for you. It should be a fairly short article, but it should tell you how to list all users. So, there’s that. By that, I mean it’ll probably do what it says on the tin, namely telling you how to list all your users.

You may want to check the list of users from time to time. Applications may add users, you may have added users, malicious software or people may have added users, etc… There are other reasons to list all users, but you get the idea.

This is a beginner-level exercise, so you shouldn’t have any difficulty with it. It should also be reasonably short, which is nice! If you find any mistakes or have any questions, scroll down and leave a comment. You can also ask on the lovely Linux.org forums.

Without further ado…

List All Users:

Once again, we start with opening the terminal. To do this, you just press CTRL + ALT + T and the terminal should open. That’s true on most distros that I’ve encountered. If not, you will still need an open terminal.

Got it open? Good, ’cause it’s a pretty easy operation. The file you’re looking for is ‘/etc/passwd’, which is a plain text file that’s in conjunction with the /etc/shadow file. Like most text files, it’s easy enough to work with them in the terminal.

You probably shouldn’t edit /etc/passwd by hand, but we’re just going to be viewing it.

So, to show the content of the file (and see the list of users):

If you want to show fewer results at a time, you can just use:

If you want, you can ‘grep’ a specific user. Just pipe the output to grep and you’re good to go. It looks like this:

If you want to use that format AND have numbered lines, one way of finding out how many users there are, then just use:

Though you could just as easily have used this to get the number:

If you want to list just the users, you can use ‘awk’ and pick the first column like this:

And that’s about it, really. You’ve now listed all the users – and counted ’em!

Closure:

That’s it! That’s all there is to it, and you’ve learned a little bit more – this time how to list users in Linux. I told you that it’d be pretty painless and easy. Plus, this is another article for the books – and this one authored early enough to give me some time to keep scheduling them ahead of time.

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.

When Did I Last Reboot My Linux Box?

If you want to know when you did your last reboot on your Linux box, it’s actually pretty easy. This article explains how. I’m still not feeling quite up to snuff, so a quick and easy article is the call for the day!

You can run uptime in the terminal, and that will tell you how long your system has been up and running. The output will look something like this:

At this point, you could do the math and find your last reboot time. Of course, this being Linux, there’s an easier way to do this. This will be a quick (and easy) article and hopefully I’m doing a bit better tomorrow.

Find Last Reboot:

Like so many of these things, we need to start with the terminal open. You can do that by using your keyboard. Just press CTRL + ALT + T and your default terminal emulator should pop right up!

With that open, you can start with:

Which will give you an output similar to:

But, the command’s usefulness doesn’t stop there. No, no it does not! You can modify the command in a couple of ways to get some more refined response. Let’s say you only want the last three results? If so, you’d use this command:

This will give you an output like this:

You can also use ‘grep’ for your refining needs. Let’s say you want to know when you last rebooted in the month of May? Well, you can easily do that!

The output of which would look similar to this:

And, there you see it. As you can see, there were three reboots in the month of May on that box. This information may be useful for debugging reasons or even compliance reasons. How you use the information is up to you! Ain’t my job to tell you how.

Closure:

There. There’s your darned article for the day!

Seriously, yesterday’s article was really messed up. Fortunately, the kind folks at Reddit chimed in and were eager to help! The folks at Linux.org are usually good at catching the mistakes, of which there were many, but probably didn’t as the article is one from the old site and probably only skimmed it if they read it at all.

This leads me to think that I’m eventually going to have issues with getting an article up every other day. I’m still going to try, and I’ve done so since the start, but it’s pretty likely that I’ll eventually miss a day. I’ll try to take steps to not let that happen, but the real world is a fickle mistress.

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

INXI is something I mention a lot. In fact, I’ve done a whole INXI article before, I like it that much. It makes sharing detailed hardware information easy. The people trying to help you when you need support may need detailed information about your hardware, which is where INXI excels and why it exists.

You may notice that I didn’t actually link to said previous article. It was a very different article. This one is really just about installing INXI, so that you can toss it out as a quick link while asking for more information. I’ll rewrite the old article to suit this site, probably when I want an ‘easy’ article. Anyhow…

When you post on forums, such as Linux.org, your question may require sharing information about your hardware. Unless otherwise specified, the way I’d run INXI is this:

Or:

The output of either of those will give you an adequate amount of information and covers most all the bases. It’s most of the available information without being all of the available information. You may be asked to run a more specific command and you should post the data between the [code]<output from command>[/code] tags to make it more easily read.

So, why this article? Well, there might as well be an article that tells you how to install it. This? This is that article. You’re welcome!

Installing INXI:

Let’s get right to it and start with the easy way. Start by opening  your terminal by pressing CTRL + ALT + T. Once that’s open, use the following command as is appropriate for your distro’s package manager.

Debian/Ubuntu: 

RHEL/Fedora:

Manjaro:

OpenSUSE:

Any of those should work with the right distro. INXI is a commonly used application and a great tool for your toolbox. So, depending on your distro, use one of those commands.

If you need to install it manually, and you’ll likely need elevated permissions for this, you can just run:

Because that doesn’t include the man page, you can grab that and install it with a simple command:

If nothing else, those last two commands should work on every Linux desktop system out there, though I suppose you may need to first install wget and need permission to write to the correct directories.

Now that you have INXI (and the manual) installed, just use the inxi -h command. If you’re asking for support somewhere, they’ll probably tell you which command they want you to run when they ask you to run it.

See also: https://smxi.org/

Closure:

Yup… This is a short article, and intentionally so. The goal here is to write an article that helps people install INXI. I think I’ve done that. I may write an article that’s more detailed, meaning ways of using INXI, but today is not that day. Today, it’s just about installation.

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.

Weather In The Terminal? We can do that!

Weather in the terminal? There are people who pretty much live in the terminal! They do everything there, including checking the weather! This article will show you how to get your local forecast in your terminal, because why not?

Where I live, they have a saying, “If you don’t like the weather, wait a minute.” The weather is constantly changing and is responsible for killing quite a few people every year. We have some pretty extreme weather. Because of this, I pay fairly close attention to it – but, really, I don’t tend to check it in the terminal. I use a more robust solution. This article is for those folks who want to. You’re welcome!

First, a little poem:

Whether the weather be fine, or whether the weather be not,
Whether the weather be cold, or whether the weather be hot,
We’ll weather the weather, whatever the weather,
Whether we like it or not.  — anonymous

See? Who says we’re uncultured here?

Anyhow, this is just going to be a pretty brief article. It’s pretty simple to check and it requires just your terminal and a tool called ‘cURL‘ (which has been covered already, so click that link to save some time). If it turns out to be something you like, you can always alias it for regular use or just commit the short commands to memory.

Weather In The Terminal:

Seeing as this is ‘weather in the terminal’ we should probably start with opening the terminal! That’s easy enough, just press CTRL + ALT + T and your default terminal will open.

Once you have it open, you’ll be using a website known as WTTR.IN. You can actually just click that link and get the weather in your browser. It should be your local-ish weather, unless you’re using a VPN. The site is using IP Address Geolocation to show your local weather and a VPN presents a different IP address, meaning it may not actually be your local weather. The same is obviously true in the terminal.

Start with just a basic example, try:

That should be ‘close enough’, depending on where you live and how accurate the geolocation is. If it’s not, you can add some information – such as town and state (or province, or whatever your country uses). It’d look something like:

The output from that command would look a little something like this:

weather forecast in the terminal
See? It even knows I’m in the USA, so it uses the correct units. Neat, huh?

You can even use some landmarks and it will try to figure it out. For instance, you can check the output from this command:

If you’re in the US, then it will show you the results in our goofy units – even if metric is used at the location. Well, it will try to – within the limitations of geolocation. If you want to change it up, you use a ‘u’ or an ‘m’. To force the above with metric units, you enter:

Anyhow, there’s so much more that you can do. Frankly, the above are all I really use it for – and I seldom bother with that. Living where I do, I get my weather in a browser and with a browser extension. So, be sure to use the following to learn more:

You can also just visit https://wttr.in/:help to get that same information in your browser. It’s up to you, but you’re already in the terminal so you might as well keep using it!

Additional info: GitHub repo is located here.

Closure:

And there you have it. Another article is in the books, this one showing you how to use your terminal to check the forecast and current conditions. There are a ton of options that I didn’t bother covering, but options that you may find useful. Be sure to check the help page and keep up with the project on GitHub.

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.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.