4 ms·
To elaborate on your comment, on UNIX systems, you don't put "." in $PATH because someone might put a malicious executable named `ls` or `cd`, in a directory. I
by naruhodo 3y ago
To elaborate on your comment, on UNIX systems, you don't put "." in $PATH because someone might put a malicious executable named `ls` or `cd`, in a directory. It doesn't have root privileges, but it runs as your user account and can get some kind of persistence by hooking `~/.bashrc`. And perhaps by wrapping `sudo` it can eventually get root privileges.
- jabbany 3y agoThat doesn't work if . is at the end of $PATH though? Since the real ones would take precedence due to how executable searching works...?
- deleted 3y ago[deleted]
- locustous 3y agoYou never type sl on accident?
- jwilk 3y agoYou should install https://github.com/mtoyoda/sl https://github.com/mtoyoda/sl as a hardening measure.
- jabbany 3y agoSurprisingly, no... I thought I would, but somehow I've avoided this particular transpositional mistake (probably also due to my habit of setting up a ll or la macro for ls -l and ls -a). That said, I also don't actually put "." in my path, though this is mainly so I can avoid heisenbugs rather than a security concern...
- fhars 3y agoIf that defence works reliably or not depends on whether you have sl installed or not. SL(6) Games Manual SL(6) NAME sl - display animations aimed to correct users who acci- dentally enter sl instead of ls.