I recently had an issue doing an upgrade of AIX Toolbox on an AIX machine and it caused the sudo program to fail because it couldn't find dependencies it needed to execute successfully. I started searching to see if there were simpler alternatives that could do a job similar to sudo and would not have so many dependencies. Of the various options out there, I found three that were interesting.

Doas was created for OpenBSD. There are different versions of the program, including a portable fork called OpenDoas. I tried this version, so I can't say much about the others at this point:
https://github.com/slicer69/doas
The program does build on Linux as well as on the BSD systems. It can use BSD functions on BSD systems for authentication but uses PAM on Linux and other systems. The pam_start function needs struct pam_conv to initialize and part of pam_conv points to a function that handles input. Linux, Solaris and some systems provide functions as part of their PAM library. However, not all systems have a library function to pass to pam_start. I wasn't able to find a supplied function on AIX. OpenDoas appears to have a function as part of the OpenDoas program itself. There are also some simple examples of a function that can be used with PAM available online if you're on an operating system that doesn't have one readily available.

Another option I came across was called please. It only offers the option of PAM authentication. It has the same issues for portability with regards to the function needed by pam_conv. You can find the source code for please here:
https://github.com/gblach/please

The last alternative I experimented with is sup. It's on the recommendations page at suckless.org. The interesting thing about this program is that it doesn't require PAM to work on various systems. That's a nice feature if you're building a minimal operating system and don't have the PAM library built and installed. It has an option to use a hash function to make sure that the user is running the program they're supposed to and not a program with the same name that has been substituted for it. The hash function has a less lenient license than the program on its own. I was thinking it would be nice to use a system library with a hash function instead of needing to use the one provided by the program. However, that would increase the number of dependencies the program requires. The sup program also has a feature to run a program with a fork. As I'm not a fan of the fork function and how many resources it uses and its lack of portability, I avoid that option at all costs. I remember the topic of fork coming up on the musl mailing list. The spawn function was mentioned as a more efficient alternative. Another difference between this program and the other two is that it uses hard-coded settings rather than needing external settings files. This requires recompiling to change options, but it makes it harder for someone else to modify the settings from a security standpoint. Source code for sup is available at:
https://github.com/dyne/sup

Upon further investigation, the sup that the suckless.org site recommends is the earlier version found here:
https://oldgit.suckless.org/sup/files.html
It does not include the hash and fork options and offers a more minimal implementation with straight-forward code.

I've seen some complaints that using sudo or operating/logging in as root can be more insecure. Alternatives may be more secure when they have less code and are easier to maintain and debug. That's one reason they may be attractive. However, the alternatives need to be well written or well tested and debugged or they can be more insecure than the standards. There's also the advantage of security through obscurity. If exploits use sudo, they may not be expecting or looking for an alternative like doas on a system. Many people prefer using whatever's standard assuming that it's secure enough or so many other people wouldn't be using it too. Just as having less code can be more secure, requiring less dependencies can also have security advantages. It's another way to limit the amount of code in a program. Using a shared library can also create security issues for a program that may need to be addressed.

As a cross-platform programmer, I always look for programs that will work on a variety of operating systems. The sudo alternatives port to many systems but many of their concepts won't transfer well to Windows or DOS operating systems. While you can have multiple users on some DOS variants, it's more of a single user operating system and restricting who can run things is not typically an issue. On Windows, this can be important. However, Windows has a completely different way of handling permissions and rights from Unix and Linux systems. I did run across some samples of sudo-like alternatives designed for Windows. However, they work very differently.

It was interesting to find out how programs like sudo or the alternatives I've mentioned function. A sudo-like program is owned by root and has a special permission set on the program file. By setting the suid bit on the file permission of the program, a non-root user can run the program as if they are the root user. A technique like this would not work natively on Windows. One can elevate permissions in Windows using the Windows API. However, it doesn't work in all cases. There's a way to use SeDebugPrivilege to elevate permissions in a program but some organizations turn that privilege off for their users.

Basically any of these types of sudo like programs uses a function such as execute or spawn or CreateProcess to run other programs. They allow a user who typically doesn't have permission on a particular operating system to have that permission by starting another program or process through that program. In some form or other, that program needs to have special rights to run other programs whether the user has the rights to or not.

I find it interesting that root automatically has permissions to copy, move or remove files, no matter what directory. On POSIX systems, running as root really solves a lot of permission issues especially when building and trying to install programs. While Puppy Linux embraces the idea of running as root and some small, single user systems work fine this way, many Unix and Linux systems highly discourage running as root. While it's nice to be able to easily install a program you built, it's not helpful if you accidentally install something over another library or program and cause your system to fail in the process. It's also easier to accidentally remove needed files in a critical directory when you have the permissions to remove anything. For instance, a misbehaving install script could easily wipe out files needed for the system to operate properly. I do feel that critical programs with dependencies, if built statically, have several advantages to programs using shared libraries. They won't fail if there are issues with finding or loading a shared library on the system. Also, someone can't hack the system by having that program load the wrong library with a function that doesn't do what's intended. At this time, static building isn't widely embraced on Linux systems and the GNU glibc library cannot be used to build static programs. One would need to use a C library such as musl if static builds are desired. I personally happen to think there are many advantages to using musl over glibc. However, at this point most Linux operating systems still use glibc. Both using alternatives to glibc and running as root are not mainstream practices and both can be controversial in many sectors. There are pros and cons to running as root versus running as another user. That's what makes programs like sudo and similar alternatives so useful. They give the power of root but can limit what you can do with it to make sure you don't accidentally run commands that could disrupt or cripple the operating system.

Personally, I'd like to see a cross-platform sudo alternative that would work with Windows as well as Unix (including AIX) and Linux operating systems. It would be nice to have a small, simple program that would work for most multi-user operating systems available. I prefer the idea of a more compact program with very limited dependencies. A static build or no extra libraries would have avoided my shared library issue on AIX which caused sudo to fail.

I'd be very intrigued to hear about other sudo alternatives that are available. I'd also be interested in hearing about the pros and cons of security with regards to use of some of these programs. What do you regularly use on your system? What alternatives to root or sudo have you found? What works well on multi-user operating systems beyond Linux and Unix? What are your security concerns using sudo or some of these alternatives and how do you work around them? Feel free to share some of your comments on the topic on Mastodon. I'll be updating this article with more information if I find other lightweight, low dependency sudo alternatives that I like.
Slow Android emulators to test Android programs may be a thing of the past on my current Windows system. I downloaded and installed Windows Subsystem for Android. It's a convenient way to test out apps you've created without having to resort to installing VirtualBox and Android x86 or using other alternatives such as Qemu or some of the very slow Android app emulators.

If you want to try out other Android apps on your Windows system, you can do that as well. It may not look like there's a wide variety of apps to choose from at first glance. Windows Subsystem for Android comes with Amazon Appstore instead of Google Play store. I've seen some reports of getting Google Play store working but it doesn't seem worth the effort and really isn't necessary. If you're just going to test your own apps, you don't need an entire app store. However, it is fairly easy to get F-Droid installed on Windows Subsystem for Android. Most of the apps from F-Droid work very well in an emulator. F-Droid had more than enough apps for my needs. Also, there are other repositories such as IzzyonDroid that can be added to F-Droid giving even more options to choose from. Finally, there are sites, such as APKPure, that will allow you to download apk files directly. Once you have the apk file, you can install the app yourself.

The basics for installing apk files in Windows Subsystem for Android follow. First, download a copy of the Google Android platform tools for Windows. adb is the program that is required from the platform tools. Start up an Android app, any Android app, in Windows Subsystem for Android. This makes sure that Windows Subsystem for Android is currently running. At the command line, type:
adb connect 127.0.0.1:58526

Once a successful connection is made, most apk files can be installed from the command line using a command similar to the following:
adb install file.apk
Substitute the actual name of the apk file for file.apk in the command.

What if you have an xapk file instead of an apk file? Rename it to a zip extension. Use a tool like unzip to extract the files in the xapk. Use the command adb install-multiple with a list of the extracted apk files.

That's all there is to it. Once that's done, you can easily install Android apps and run them on Windows. I found some actually run better on Windows than on a phone. However, some did not fit the screen well and some required Bluetooth which is not yet supported in Windows Subsystem for Android. Still, you can run quite a nice selection of apps and you can use it to test your own Android apps as you develop them.
I've continued my search for organizing software ( https://lmemsm.dreamwidth.org/25452.html ). I've tried several options available from F-Droid and Google Play. I've run across interesting concepts such as using gamification and rewards systems to encourage new habits or complete large tasks. There are also tools to help set goals (such as Specific, Measurable, Achievable, Relevant and Time-Bound SMART goals), break down tasks, remind when to do a task and track what's completed. With all those apps and even some FLOSS programs out there, I've yet to find anything I'm comfortable working with. Some of the commercial mobile apps have wonderful concepts behind them. However, they also have fees or ads or require you to sign up for a service on the Internet. The F-Droid apps are typically more friendly when it comes to privacy. They don't have ads and most don't require sending personal data over the Internet. They're typically simpler than the commercial apps which can be a good thing. However, it's a matter of finding one that does what you need in a way that's comfortable to you not just what the developers and core users need.

I've been reading a lot lately about flow states and the psychological inertia many experience when they're trying to break out of the flow and do something else. Writers may get lost in writing and forget to break for a meal. A programmer may be so engrossed in a coding project, he or she may not notice the clock and the fact that it's time to go home. Who really wants to miss that? Inertia can also make it hard to start a new task. So, I tried to narrow my search to alarm programs that could notify me when to change focus and switch tasks. There are several timer programs that can time tasks for you and fire off an alarm when the interval to work on a task is over. I decided I wanted something more along the lines of an alarm that notified me at a specific time every day. It was suggested I check out the Google clock program which has an alarm. The alarm certainly got my attention. However, I couldn't turn it off without turning off my phone completely and it could easily annoy people around me.

I finally decided to overcome my own inertia and stop searching for a solution and just write one. I used SDL because it ports to a number of platforms including mobile devices. I broke the job up into tasks and started with the most crucial pieces I needed. I figured it would be more difficult to come up with a file format and source code to decipher multiple alarm times, so I started by hard-coding the time. Then, I switched to passing the time via the command line. Once I got that working, I realized, I don't really need to store several alarm times in an initialization file for the program. Using the Unix philosophy of doing one thing well, I decided to leave that task to another program and call this one just to display one alarm. So, one could combine this program with another program like remind or one could use cron or Windows task scheduler to start this program when needed.

What I really wanted was a way to gradually shift gears when I'm heavily concentrating on something. I did not want a jarring alarm. I wanted something that would give me time to complete what I'm doing and transition to something else. I really liked the Toastmasters concept of using green, yellow and red signaling to decide when to end an ongoing talk. So, I started with the color concept. I added a way to play an optional wave file with it. By limiting what the program did to just handling the alarm related tasks, I was able to get it done in a fairly reasonable amount of time.

While I was searching for useful organizing and scheduling programs, I experimented with remind. I found it very promising, but it takes some work to create the entries you want to be reminded about. The main drawback is that its designed for Linux and the developer would prefer that it not be ported to non-Free operating systems. While it can be ported, I'd prefer to work with software created by developers who want to support multiple platforms. I do like the idea that it's a command line tool and can be customized using a text file. Instead of using todo programs, I've been using simple text files to keep track of my lists. I've found that more effective. Something like the todo.txt file used by todo.c and other programs might be an option at some point in the future because it combines the idea of a simple text file with a more programmatic tool. It would be nice to see a todo tool and an alarm tool combined. Possibly if a time is part of each task, a program could parse out times and activate an alarm when needed. So, I'm still searching for the right tools to use together to help improve organization. However, I'm happy to finally have an alarm that offers the features I most wanted.

I'd be very interested to hear how others organize and switch or begin new tasks when they're experiencing inertia. What tools and programs do you use? What works? Also, if anyone is interested in brainstorming putting together different simple tools that each do one task well to help improve organization and efficient use of time, feel free to contact me. Discussion is welcome via Mastodon (https://fosstodon.org/@lmemsm) or the distasis mailing list on groups.io.

April 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27282930   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 23rd, 2025 12:12 pm
Powered by Dreamwidth Studios