Quantcast
Channel: User Sourav Kannantha B - Stack Overflow
Viewing all articles
Browse latest Browse all 60

Is calling ssh without user is same as calling it with getuser?

$
0
0

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).


Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>