4 ms·
I once typed something like: echo "test mail message" > /usr/bin/qmail instead of: echo "test mail message" | /usr/bin/qmail and went on holiday. Many lesso
by camperman 11y ago
I once typed something like:
echo "test mail message" > /usr/bin/qmail
instead of:
echo "test mail message" | /usr/bin/qmail
and went on holiday. Many lessons learned.
- gruez 11y agowhy would you use absolute path for qmail?
- dredmorbius 11y agoNot trusting root's path is defensive practice. What's 'qmail'?
- ketralnis 11y agoThe first google result for qmail: > qmail is a mail transfer agent (MTA) that runs on Unix. It was written, starting December 1995, by Daniel J. Bernstein as a more secure replacement for the popular Sendmail program; qmail's source code is in the public domain.
- dredmorbius 11y agoWrong question. Not "what is the application 'qmail'" (I'm quite aware, thanks). But "what is the token 'qmail'" evaluated to by the shell. If you prefer: "which qmail".
- nailer 11y agoThat's a a good question. The mail client (most boxes uses mailx to implement it these days) is normally just 'mail'. and qmail would normally be in an sbin dir.
- dredmorbius 11y agoNote: the question applies to all executed commands.
- ketralnis 11y agoSorry, I misunderstood you. I retract my snark :)
- ciupicri 11y agoIf root's PATH environment variable can be compromised, then you might as well ditch the whole system.
- dredmorbius 11y agoIt may not be common practice (I typically rely on $PATH). But it is, as I noted, defensive. There are numerous ways in which $PATH can change. Shared profiles and other users modifying root's init among them. Intent isn't necessarily malicious. It can still be unexpected.
- rhinoceraptor 11y agoThere was a Steam script that had a nasty habit of running '# rm /*' due to an empty script variable.
- dredmorbius 11y agoI do not trust vendor scripts. Really fscking annoying: scripts that include inline binary data.
- photosinensis 11y agoHabit from scripting. Remember that users can modify their own paths, possibly to prioritize ~/bin over everything else (which may have unexpected behavior).
- camperman 11y agoThis was years ago - about 15 I think - and I can't actually remember why. I could lie and say it was something that djb wrote in the manual about best practice at the time but I think it was more likely habit.