Skip to main content

Timeline for Can I hook into the cd command?

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Dec 23, 2018 at 20:36 comment added DarkWiiPlayer I found this question while doing just that: if I cd somewhere, check for a .bashcd file and run it if it exists.
Jan 29, 2016 at 12:42 comment added lost-and-found Thanks for the security insight @StéphaneChazelas. I have to admit I didn't even think about it.
Jan 14, 2016 at 12:35 comment added Stéphane Chazelas It seems generic, but you're introducing a security vulnerability. Someone or something only needs to plant a hook-script in /tmp for instance to make you run any code the next time you cd there. You'd want at least to make sure that the hook-script is owned by you, not a symlink, not writable by anyone other than you, that the directory it's in is only writable by you... See Keeping history per working directory (cf. per shell session) for a safer approach.
Jan 14, 2016 at 10:37 review Late answers
Jan 14, 2016 at 10:41
Jan 14, 2016 at 10:29 history edited user34720 CC BY-SA 3.0
edited body
Jan 14, 2016 at 10:22 review First posts
Jan 14, 2016 at 10:29
Jan 14, 2016 at 10:21 history answered lost-and-found CC BY-SA 3.0