I am installing certificates on a remote server and want to check whether they exist before I overwrite them. The server only allows non-root access via ssh public key. I can
sudo -s to root once in a shell. Root is required because /etc/ssl is not readable by anyone else. This is being developed in
python fabric, so any command that can be run in a shell command via
sudo would work. I don't mind typing in passwords at prompts in this case.
TL;DR: I need an
sh command that can tell my python program whether a remote file (or directory) exists when run as
if fabric.sudo(sh_command) == True: (or something similar).