If I want to start a ssh process from python, is invoking ssh
without any user (subprocess.run(['ssh', 'remotehost'])
), is equivalent to invoking ssh
with getuser (subprocess.run(['ssh', '{}@remotehost'.format(getpass.getuser())])
) ?
If not, is there a reliable way to get what would have been the default user to ssh otherwise?
What I am trying to do is, start a long running process in the background in remotehost. Then I want to store the pid of the newly created process along with the user. But I am unsure how to get the user in case the user passes user=None to my function (which is technically correct as ssh doesn't necessarily require user argument).