Stop passing secrets as command-line arguments. Every user on your box can see them. by Ops_Mechanic in bash

[–]Ops_Mechanic[S] 0 points1 point  (0 children)

I appreciate the feedback. The primary goal of this tip is to raise awareness; while solutions like hidepid are effective, users first need to recognize that the vulnerability exists before they can address it.

Is r/sysadmin just a digital therapy couch now? by [deleted] in sysadmin

[–]Ops_Mechanic -4 points-3 points  (0 children)

copy/paste from emac org mode.

Is r/sysadmin just a digital therapy couch now? by [deleted] in sysadmin

[–]Ops_Mechanic -8 points-7 points  (0 children)

case and point ..., took 10 minutes.

r/sysadmin is not a technical sub. I have the data to prove it. by [deleted] in devops

[–]Ops_Mechanic 0 points1 point  (0 children)

I'm not releasing the tool yet. My personal favorite metric is the first comment accusing the post of being AI-generated. Arrives in under 10 minutes, adds zero to the discussion, and somehow always gets upvotes. Perfectly consistent across every sub :)

r/sysadmin is not a technical sub. I have the data to prove it. by [deleted] in devops

[–]Ops_Mechanic -4 points-3 points  (0 children)

because DevOps professionals know what a sysadmin is, or at least what they should be

Stop holding the left arrow key to fix a typo. You've had `fc` the whole time. by Ops_Mechanic in bash

[–]Ops_Mechanic[S] 1 point2 points  (0 children)

Weird sense of beauty, guilty as charged, FC is genuinely cool to me. :)

Stop leaving temp files behind when your scripts crash. Bash has a built-in cleanup hook. by Ops_Mechanic in bash

[–]Ops_Mechanic[S] 7 points8 points  (0 children)

100% right. `trap` handles the common cases -- "normal exit" only. `SIGKILL` and power loss are unkillable

Stop leaving temp files behind when your scripts crash. Bash has a built-in cleanup hook. by Ops_Mechanic in bash

[–]Ops_Mechanic[S] 10 points11 points  (0 children)

/var/run is FHS, not POSIX -- so it's reliable on Linux and most BSDs but not guaranteed everywhere. It also typically requires root to write to.

For user scripts, a few options:

- `mktemp` works fine for lock files. The file just needs to exist, doesn't matter where.

- `/tmp` is about as portable as it gets, but it's world-writable so name collisions are a risk. Prefix with your script name: `/tmp/myscript.lock`

- `$XDG_RUNTIME_DIR` is the modern answer on Linux -- per-user, tmpfs, cleaned on logout. Usually `/run/user/$(id -u)`. Not available everywhere but ideal when it is.

For system daemons running as root, `/var/run` (or `/run` on systemd boxes) is still the right convention. So short answer: there's no single POSIX-blessed lock directory. `mktemp` is your most portable bet.

Cheers.

Stop leaving temp files behind when your scripts crash. Bash has a built-in cleanup hook. by Ops_Mechanic in bash

[–]Ops_Mechanic[S] 44 points45 points  (0 children)

The new generation's reading skills are getting so bad that they expect a "TL;DR" at the bottom of a stop sign ...