我面臨一個問題,因爲我ssh到另一臺機器,我的paramiko ssh會話沒有看到相同的系統路徑,當我手動ssh到機器。 這裏是我的Python代碼:蟒蛇paramiko ssh會話沒有得到系統路徑
cmd = "echo $PATH"
try:
ssh.connect(ip, username=username, password=password)
except Exception as ex:
raise Exception("Failed to connect to %s with credentials username='%s' password='%s' %s" \
% (ip, username, password, ex.message))
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd)
output = ssh_stdout.read()
輸出顯示在/ usr/bin中:/ bin中 但是當我手動ssh到機器,也有對系統PATH其他幾個路徑。 請幫忙。