This is part 6 in the series of “Beyond the good ol’ LaunchAgents”, where I try to collect various persistence techniques for macOS. For more background check the introduction. I learned about this trick from @0xdade when he posted it on Twitter. If we create a file in the user’s HOME directory at ~/.ssh/rc it will be executed prior to the user’s login shell becomes available. The man page of sshd describes this in more detail.