Category Archives: Howto

Auto Added by WPeMatico

WHO DID WHAT WITH ROOT?!

When you are not sure who is using SUDO on a server, and you really need to know who keeps making that annoying change.  You can install something to watch them, and maintain that software and related logs. Keep it setup in your package management system, and make sure it doesn’t have any patches.

OR

You could use the little-known (at least those I have asked in the field) modifications I will list below.  They are two fold.  One, you will enable to record who logs in and uses SUDO, and records their session. Much like many pieces of software out there today.  The one catch to my method is simple.  You already have the software installed, yup this has been a feature of SUDO since version 1.7.4p4.  So nothing else to install, worry about, or maintain.  It is also very easy to setup, see below:


/etc/sudoers modifcation:
All you need to do is to add 2 tags to all required sudoers entries.
*(where "su" specified, either with command or alias). 
LOG_INPUT and LOG_OUTPUT
Example: 
%admins ALL=(ALL) NOPASSWD: LOG_INPUT: LOG_OUTPUT: ALL

It will add the following default log dir structure to sudoers: Defaults iolog_dir=/var/log/sudo-io/%{user}
Note:
Output is logged to the directory specified by the iolog_dir option (/var/log/sudo-io by default) using a unique session ID that is included in the normal sudo log line, prefixed with TSID=.  The iolog_file option may be used to control the format of the session ID.  Output logs may be viewed with the
sudoreplay(8) utility, which can also be used to list or search the available logs.   Keeping in mind that if the user has a really long session you will be viewing it like a movie, it will replay as if he is sitting there typing.  With this in mind, sudoreplay gives you the ability to play back at faster speeds.  This makes it easier to find where things happened in a long recording.

So that is one good method to help find a culprit, but what if you are just looking at history of root?  Can you tell me who ran what? Can you tell me when they ran the commands you see when you type ‘history’?  By default, no.  The next tidbit of info is very useful, and extremely easy to add to your machines.  Simply add the following to your /etc/profile:

export HISTTIMEFORMAT="%m.%d.%y %T "

Yes, that is a space at the end.  If you do not put that in there you will end up with it running together with the actual command typed in history.  So your history should look like the example below:

1995 06.10.15 13:08:05 top
1996 06.10.15 13:08:05 clear
1997 06.10.15 13:08:05 df -h
1998 06.10.15 13:08:05 umount /media
1999 06.10.15 13:08:05 sudo umount /media
2000 06.10.15 13:08:05 sudo su –
2001 06.10.15 13:08:07 history

I hope this helps someone save some time, as it has me.  Please feel free to share with others.

-M

 

Linux Gaming just got way better!

Since the release of ProtonDB, there have been over 2500 games added to Linux!

What is Proton?

Proton is a new tool released by Valve Software that has been integrated with Steam Play to make playing Windows games on Linux as simple as hitting the Play button within Steam. Underneath the hood, Proton comprises other popular tools like Wine and DXVK among others that a gamer would otherwise have to install and maintain themselves. This greatly eases the burden for users to switch to Linux without having to learn the underlying systems or losing access to a large part of their library of games. Proton is still in its infancy so support is inconsistent, but regularly improving.

ProtonDB is used to collaborate on performance on different hardware/software configurations. Allowing the community to work together to get the games working.

Setting Up Proton in STEAM – Tested Ubuntu 18.10

How to use a PS1 in Linux/MAC

Here are the PS1‘s I use for my daily driver.  Feel free to take them and change them up.

I use different colors, so one doesn’t accidentally login or run something as root (which is in red, users are yellow).

To use these, simply copy and paste them into either the root user; or regular user’s .bashrc.

Alternatively you can add them to /etc/profile to make them enforced system wide. 

For MAC, it is the same; however the PS1 is a little different. See below.

 

Root

 

User

Using Nano with Markdown in Linux

Fan of nano?  Like having pretty colors to see where you messed up? Of course we do!  Much like many of us, I use nano.  Its quick, easy, and readily available.  However, I like to see the highlighting of my language.  As many of you know, there are “nanorc” files, that will tell nano how to handle language highlight.

They are usually located in  /usr/share/nano/ (at least in ubuntu); and you can make your own under your home directory with a .nanorc file.  I can post about that later…

For now let get markdown working in nano!

You will need to create a file called markdown.nanorc by doing the following:

 sudo touch /usr/share/nano/markdown.nanorc

Now that the file is created, we just need to populate it with the following below text, in a pastebin for your convenience.  Just copy that text, and paste it into the aformentioned file. Once a new session is started, you will be able to start using markdown.

https://pastebin.com/raw/tHkBqdef

Just a little note as well; if you have a need for another language, you can follow the same instructions with their pre-reated files.  Take a look here, to see other nanorc files.  Also, nano has just been updated after a very long while, please take a look at the new support when you can.

 

 

 

Finally a good note app for devs

Open Source Note Taking

This app is nice as it can be local, one time synced, or just offline notes if you are in a secure area (what started my search).  I am on a network where I can’t get to any cloud services at all, especially ones where you can give out data.  I am however able to go out and do research.  Leaving me with a tone of notes, and nothing to store them in with any sort of sense.

Also, I have a lot of markdown, and code snippets, and that sort of thing.  So, like most I started keeping plain text files.  This was not cutting it though; as many of you know.  II would on occasion have a mixture of code types in the same note.  This seems to handle those for the most part.  Although it is similar to Atom, which is my favorite IDE/text editor in a GUI; it is much lighter and doesn’t always try to correct me into some language.

At the end of the day, its just a great note app; and the files underneath are up to you to encrypt/sync/etc.  The editor I am referring to is Boostnote.  I will give a link to GitHub, and link to their sites download page.  Please try it out and enjoy! I hope this helps out a nerd out there somewhere.

 

Thanks,
Matthew Curry

MattCurry.com

Kill Switch Pictures/Update

Hello All,

For those following along, I have moved Kill Switch, my sons e-vehicle project. To a permanent page.  I have also added a gallery for the work as I go.  Keep an eye…

You can also subscribe to my RSS if you like.

Thanks,
-M


P.S.

Thanks to TJUMP7 for the donated 4gb SD card, and help with the motor controllers!  I can’t wait to get all the parts and get it going!

Jasper Image Updates[Update]

I have been quietly working on the installer and image.  However, there have been 2 OS updates since I started.  So I am refreshing all of my images with Raspbian Stretch.  I will be making it available soon.  Also, if anyone has a class 10, 4GB MicroSD they want to donate. I am trying to make the image as small as possible.  Please contact me directly for details.

The new Image will be based on Raspbian Lite as mentioned above, and will have the basic dependencies met.  It will also have newer versions of all the software pre-compiled to save you the hours of time it can take.

I am working on software to auto-configure most audio devices.  This is something I hope to include soon.  Please keep an eye out for the new links.

Thanks,

Matthew Curry

[UPDATE]

Thank you to TJUMP7 for the 4gb Card!  Small Image coming soon!  Keep an eye out for that and the installer….

 

[UPDATE] 01/24/2018 – After being out for a while for personal reasons, I am glad to say I am back. I will be working on the updates/releases soon.

Updates on Kill-Switch (E-Vehichle for son).

During my latest testing phase, there was an accident with the motor controller.  This has put a small speed bump in my little project.

However, this may be a blessing in disguise.  I wanted to put in my own motor controller before, but I was trying to do this build without purchasing much.  So, I was using the built-in controller within the old hover board housing.  This came with many obstacles; for one, the circuit was very sensitive to change.  If I wanted it to work; the LEDs and everything had to be perfect. Otherwise it would throw errors. Keeping in mind that I do not have any manual, documentation, etc on the hardware here.

Once I replace their motor controller with mine, it will be even better for my automation.  I actually do have RPI motor controller HATs; however nothing rated for 500w.  So I am going to be using the following per side. http://a.co/eHzWM2i

This will allow me to control the speed with the battery, and hub motors I already have. Just add a potentiometer per side, and were in business. Those pots will be controlled via very small servo.  This will allow the user to control them, but the servos will put them back to zero (stop) after use.  This also enables the control via RPI3, as I mentioned before.

On another note; I am considering using casters in the front since you will be able to steer via the controls.  Alternatively, I get one controller and use it as a throttle only.  This would work, but then I would have to have front steering.

 

Thanks for all the support,

Matt Curry

Handy One-Liners – Full Debian Update

This one is great for a “Full Update” on debian / ubuntu machines.

It calls the script without ever installing anything (assuming curl is installed).  Be sure to run as root, either with sudo or as root directly.

As you can see in the snippet; it uses a script that is remotely hosted (in a github gist).  This is great because you  can see exactly what it does by looking at the script.  It just calls system commands, so it can’t do anything malicious.  Just run sudo, then the above command and it will run the below script:

Another trick you can do with something like this, is copy it to  /usr/bin/fullupdate (as root of course), and ensure its executable “sudo chmod +x /usr/bin/fullupdate”.  Then you can call “sudo fullupdate”, from anywhere and use it when needed. Alternatively, you can use it on a cron to run on a schedule!  If you don’t want all the options, just download the script and change it for your liking.

 

Welcome to open source.

DIY Eclipse Glasses

Nothing Fancy here, but they work. (Use are your own risk)

First off, never look directly into the sun!  Always have the PROPER eye protection!

Supplies
1. Pen
2. Paper
3. Cereal box
4. Aluminum foil
5. Scissors

Yes, that’s it!

How to make an eclipse viewer yourself:
1. Put the cereal box on the piece of paper and trace the outline of the bottom of the box, creating a rectangle.
2. Cut out the rectangle.
3. Take two pieces of tape and make loops, then place them on both ends of the rectangle.
4. Take the piece of paper and place it inside the bottom of the cereal box tape-side down.
5. Close the cereal box up once the piece of paper is inside.
6. Create two holes in the top of the box, one on each side.
7. Cut the holes out with scissors — one will be for your eye, and the other will be covered by foil.
8. Tape the top of the box down revealing the two holes.

9. Take a piece of aluminum foil and cover one of the holes up (it doesn’t matter which one you choose.)
10. Take your pen, make a tiny hole in the middle of the aluminum foil.

And you’re done!