{"action":"created","issue":{"url":"https://api.github.com/repos/phpseclib/phpseclib/issues/725","labels_url":"https://api.github.com/repos/phpseclib/phpseclib/issues/725/labels{/name}","comments_url":"https://api.github.com/repos/phpseclib/phpseclib/issues/725/comments","events_url":"https://api.github.com/repos/phpseclib/phpseclib/issues/725/events","html_url":"https://github.com/phpseclib/phpseclib/issues/725","id":92677067,"number":725,"title":"SFTP server DisplayLogin (/etc/motd style post login message) breaks Net_SFTP::login()","user":{"login":"palepurple","id":203929,"avatar_url":"https://avatars.githubusercontent.com/u/203929?v=3","gravatar_id":"","url":"https://api.github.com/users/palepurple","html_url":"https://github.com/palepurple","followers_url":"https://api.github.com/users/palepurple/followers","following_url":"https://api.github.com/users/palepurple/following{/other_user}","gists_url":"https://api.github.com/users/palepurple/gists{/gist_id}","starred_url":"https://api.github.com/users/palepurple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palepurple/subscriptions","organizations_url":"https://api.github.com/users/palepurple/orgs","repos_url":"https://api.github.com/users/palepurple/repos","events_url":"https://api.github.com/users/palepurple/events{/privacy}","received_events_url":"https://api.github.com/users/palepurple/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-02T16:20:57Z","updated_at":"2015-07-05T16:04:17Z","closed_at":null,"body":"When using proftpd's SFTP server, I'm able to specify an /etc/motd style message which is shown after login (DisplayLogin config option). \r\n\r\nNet_SFTP does support a Banner style message, but it doen't seem to support a after-login-message.\r\n\r\nA command line 'sftp' client (via openssh 1:6.7p1-5) is able to login without issue.\r\n   \r\nWhen the authentication requests are made, the server logs them as being successful, but \\NetSFTP::login() is not returning true.\r\n\r\nRummaging through the code a little, it looks like a NET_SSH2_MSG_CHANNEL_EXTENDED_DATA type packet is coming back which confuses Net_SSH2::_get_channel_packet($client_channel, $skip_extended = false) { ... } (around line: 3046 of SSH2.php on master ...).\r\n\r\n    $ sftp -P 2222 testsftpz70@testsftpz92.example.com\r\n    testsftpz70@testsftpz92.example.com's password: \r\n    Hello world. <- troublesome message!\r\n    Connected to testsftpz92.example.com.\r\n    sftp> \r\n   \r\ncode wise :\r\n\r\n    $sftp = new \\phpseclib\\Net\\SFTP($hostname, 2222);\r\n    $ok = $sftp->login($username, $password); \r\n    // $ok == false\r\n\r\nor\r\n\r\n   $sftp = new Net_SFTP($hostname, 2222);\r\n   $ok = $sftp->login($username, $password); \r\n   // $ok == false\r\n\r\n\r\nI've tested this against 0.3.* releases, and also modified the code to run against master ( 8cad45cd6b9711ec69a982d1485bddc01da3fadd ) and it still seems to misbehave in the same way.\r\n"},"comment":{"url":"https://api.github.com/repos/phpseclib/phpseclib/issues/comments/118635393","html_url":"https://github.com/phpseclib/phpseclib/issues/725#issuecomment-118635393","issue_url":"https://api.github.com/repos/phpseclib/phpseclib/issues/725","id":118635393,"user":{"login":"terrafrost","id":214474,"avatar_url":"https://avatars.githubusercontent.com/u/214474?v=3","gravatar_id":"","url":"https://api.github.com/users/terrafrost","html_url":"https://github.com/terrafrost","followers_url":"https://api.github.com/users/terrafrost/followers","following_url":"https://api.github.com/users/terrafrost/following{/other_user}","gists_url":"https://api.github.com/users/terrafrost/gists{/gist_id}","starred_url":"https://api.github.com/users/terrafrost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terrafrost/subscriptions","organizations_url":"https://api.github.com/users/terrafrost/orgs","repos_url":"https://api.github.com/users/terrafrost/repos","events_url":"https://api.github.com/users/terrafrost/events{/privacy}","received_events_url":"https://api.github.com/users/terrafrost/received_events","type":"User","site_admin":false},"created_at":"2015-07-05T16:04:17Z","updated_at":"2015-07-05T16:04:17Z","body":"Well it's not an issue with SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1. I edited the /etc/motd file, set PrintMotd to yes in /etc/ssh/sshd_config and restarted OpenSSH and was able to see the MOTD just fine with the following:\r\n\r\n```php\r\n<?php\r\ninclude('Net/SSH2.php');\r\n\r\n$ssh = new Net_SSH2('127.0.0.1', 4022);\r\n$ssh->login('ubuntu', 'big1word');\r\n$ssh->setTimeout(2);\r\necho $ssh->read();\r\n```\r\nSo that establishes that the MOTD is working. When I SFTP in I don't see the MOTD at all. Not even in the log files do I see it being sent. Which makes sense since SFTP doesn't really provide a mechanism for extraneous information like that to be sent. SSH provides for a banner message to be sent (as your post notes) but that's distinct from the MOTD.\r\n\r\nI am also unable to install proftp via apt-get via Ubuntu. http://www.liquidweb.com/kb/how-to-install-and-configure-proftpd-on-ubuntu-14-04-lts/ suggests that on 14.04 I should be able to do `sudo apt-get install proftpd` but that doesn't work.\r\n\r\nIn lieu of that...  can you get me log files?"}}