At work we have freeBSD testmachine. And we have a PHP script that uses SSH2 protocol to connect with the freeBSD server. With this script I'm not able to connect to the freeBSD server. I wanted to install it, but I'm not sure where to find the right source to compile.

The connection can be made with a different machine, but isntalling a new distro isn't the solution right now.

I can connect to the server over ssh, but not with the ssh2 protocol in PHP (http://nl.php.net/ssh2).

  • What version of FreeBSD? What's the output of "uname -srm"? How about the version of ssh: "ssh -v"? – Geoff Fritz Dec 2 '09 at 17:27

FreeBSD has OpenSSH-server installed by default

Enable it with sshd_enable=YES in rc.conf, and run "sh /etc/rc.d/sshd start"

Edit: Make sure "Protocol 2" is enabled in /etc/ssh/sshd_config and reload sshd with "sh /etc/rc.d/sshd reload".

| improve this answer | |
  • I can connect to the server with SSH. That ain't the problem. But not by the SSH2 protocol. this is different from SSH1. – Robert Cabri Dec 2 '09 at 14:41
  • Please paste the output from "grep 'Protocol' /etc/ssh/sshd_config" – pauska Dec 2 '09 at 14:55
  • sshd_enable="YES" is allready set – Robert Cabri Dec 2 '09 at 14:56
  • FreeBSD's SSH server uses tcp_wrappers. Make sure that /etc/hosts.allow allows ssh access from the server running the php/ssh script. – Geoff Fritz Dec 2 '09 at 17:22
  • I repeat, please post the output from "grep 'Protocol' /etc/ssh/sshd_config" – pauska Dec 2 '09 at 21:25

make sure sshd_enable="YES" is in /etc/rc.conf

/etc/rc.d/sshd keygen

/etc/rc.d/sshd start

SSHv2 is allowed by default, but freebsd also allows sshv1. I set protocol to 2 only, but this should be option for what you're trying to accomplish.

| improve this answer | |

Either build it by doing

cd /usr/ports/security/ssh2
make && make install

or install it using

pkg_add -r ssh2

This should do the trick.

Best wishes, Fabian

| improve this answer | |
  • OpenSSH (the ssh server/client included in the base FreeBSD system) supports the SSH2 protocol (and only SSH2) by default since SSH1 has security issues. The installation of the ssh2 port shouldn't be necessary. – Geoff Fritz Dec 2 '09 at 17:19

Open terminal and use bellow commands to install ssh2

cd /usr/ports/security/ssh2 make && make install

or use

pkg install ssh2

this should work properly

| improve this answer | |
  • 1
    I don't think this adds anything that Halfdan's answer doesn't - and that has been criticised for being wrong. – MadHatter Feb 24 '16 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.