Category Archives: Tips

Tips and Tricks

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

Best Editor / IDE?

I have tried many editors in Linux, Mac, and even Winblows.  However, none of them like this…  Please take a look at this video and you will be surprised at the customization that is possible with this editor.  No matter your language, theme, or plugin preferences.  It also has its own package manger to mange all the awesomeness so you dont get corn-fused…

 

 

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!

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.

Got an Idea? Need Help? Raspberry PI prototyping!

Just another thing that I helping with lately.  If anyone need help with a new idea for a Raspberry PI, or IoT device message me.  I have been  through several POC’s (proof of concepts).

Keep in mind, if you are working on a new product; or sensitive information I keep all client info secret, and have no issues with an NDA.

  • Home Automation
  • Voice Recognition
  • Several TTS/STT Options
  • Custom Hardware
    • Integration with existing hardware
  • Custom Software
    • Custom Plugins/Adjustments
    • Coding
  • R&D on Subject Matter
    • Build
    • Test
    • Design
  • … and whatever else is needed …

Happy to just answer questions; or see what I can do to help.  Just contact me.

Building E-Vehicle/Robot for Son!

I am building a robot (named aptly: Kill Switch) from old parts I had laying around, and it is powered by hub motors from a ‘hover-board’.  The stats were pretty strong for small kids; so I am building a lot of safety into it.

This will include software, and hardware measures to ‘take over’ the device, and even limit speed.  Eventually I will be able to return him back to a certain spot with playtime is over.  I hope to automated charging as well eventually.  There are a lot of features I have ready; however I am still building out the hardware.

This can be difficult to do and keep extremely safe.  So for starters I am testing it only; and I have 2 kill switches I am putting in to ensure safety.  One the person will have to keep his foot on constantly for the buggy to run.  The other is a simple quick kill switch.  (Eventually these will be automated).

The Device already has an RPI3 with a small motor-controller for future automation’s.  This will control other aspects of the vehicle via software.  Such as speed limitations, power usage, GPS, WIFI, BT.  I will also be using a pico router to establish a LAN around the device.  This is for media, as the vehicle will have speakers/screen to watch/host media on the LAN.

Hardware Safety Features:

  • Dash Kill Switch
  • Foot Kill Switch
  • Flip/Tilt Sensor
  • Lights
  • Front
  • Rear

Once testing is completed, and it works; I will go through how I set it up.  However, this will be piece by piece as I do it.  I have even considered some youtube videos.  However, that will depend on my success in doing this on a budget.  I am also using completely reclaimed parts, minus a couple bolts I bought.  So its been free so far.

On that note, I have been building the chassis, but if anyone in the Dallas, TX area has an old go-cart frame that rolls/steers, I am looking.  I think it would make it a lot lighter.  Shoot me a message, info is on my contact me page.

 

MUCH More to come… Please keep an eye on the series…

-M