{"action":"created","issue":{"url":"https://api.github.com/repos/StackStorm/st2contrib/issues/505","repository_url":"https://api.github.com/repos/StackStorm/st2contrib","labels_url":"https://api.github.com/repos/StackStorm/st2contrib/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/StackStorm/st2contrib/issues/505/comments","events_url":"https://api.github.com/repos/StackStorm/st2contrib/issues/505/events","html_url":"https://github.com/StackStorm/st2contrib/issues/505","id":159707191,"number":505,"title":"Opening SFTP connection causing issues","user":{"login":"codyaray","id":44062,"avatar_url":"https://avatars.githubusercontent.com/u/44062?v=3","gravatar_id":"","url":"https://api.github.com/users/codyaray","html_url":"https://github.com/codyaray","followers_url":"https://api.github.com/users/codyaray/followers","following_url":"https://api.github.com/users/codyaray/following{/other_user}","gists_url":"https://api.github.com/users/codyaray/gists{/gist_id}","starred_url":"https://api.github.com/users/codyaray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyaray/subscriptions","organizations_url":"https://api.github.com/users/codyaray/orgs","repos_url":"https://api.github.com/users/codyaray/repos","events_url":"https://api.github.com/users/codyaray/events{/privacy}","received_events_url":"https://api.github.com/users/codyaray/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-06-10T19:37:06Z","updated_at":"2016-06-17T18:10:52Z","closed_at":"2016-06-14T12:38:50Z","body":"Discussed on Slack: https://stackstorm-community.slack.com/archives/community/p1465570980000803\r\n\r\ntl;dr - I'm connecting from StackStorm to a Windows machine running cygwin sshd using `core.remote`. When accessing network resources with the correct permissions (username/password), we're getting an Access Denied through StackStorm but are able to access through Paramiko directly.\r\n\r\nThe test command is simply `dir \\\\mywindowshost\\c$`. [This gist](https://gist.github.com/codyaray/9138c7a55c4fe507b98305518268324c) contains all the stuff from my investigation:\r\n\r\n1. **st2_windows_execution.log**: debug logs from st2actionrunners\r\n2. **paramiko_raw.py**: successful pure paramiko connection\r\n3. **paramiko_raw_channel.py**: successful pure paramiko conn with low-level channel API like st2\r\n4. **paramiko_st2.py**: failed wrapper around st2's ParamikoSSHClient directly showing \"Access Denied\"\r\n5. **paramiko_raw_ftp_fail.py**: failed pure paramiko connection which opens ftp client like st2\r\n\r\nBasically, commenting out `client.open_sftp()` on [this line](https://github.com/StackStorm/st2/blob/58fbabf116da8292cd6a404099072c6ca54cfc3c/st2actions/st2actions/runners/ssh/paramiko_ssh.py#L145) allows us to successfully access the network resources in this manner.\r\n\r\nInterestingly, the Paramiko client has to be reconnected once an FTP session has been opened. Even opening and then closing the FTP client prior to executing a command causes it to fail.\r\n\r\n@Kami suggests that we should conditionally [only open the FTP client when we need it](https://stackstorm-community.slack.com/archives/community/p1465579563000892)."},"comment":{"url":"https://api.github.com/repos/StackStorm/st2contrib/issues/comments/226841288","html_url":"https://github.com/StackStorm/st2contrib/issues/505#issuecomment-226841288","issue_url":"https://api.github.com/repos/StackStorm/st2contrib/issues/505","id":226841288,"user":{"login":"Kami","id":125088,"avatar_url":"https://avatars.githubusercontent.com/u/125088?v=3","gravatar_id":"","url":"https://api.github.com/users/Kami","html_url":"https://github.com/Kami","followers_url":"https://api.github.com/users/Kami/followers","following_url":"https://api.github.com/users/Kami/following{/other_user}","gists_url":"https://api.github.com/users/Kami/gists{/gist_id}","starred_url":"https://api.github.com/users/Kami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kami/subscriptions","organizations_url":"https://api.github.com/users/Kami/orgs","repos_url":"https://api.github.com/users/Kami/repos","events_url":"https://api.github.com/users/Kami/events{/privacy}","received_events_url":"https://api.github.com/users/Kami/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T18:10:52Z","updated_at":"2016-06-17T18:10:52Z","body":"@codyaray Great, thanks for confirming :)"}}
{"actor":{"display_login":"Kami"}}