# security/ssh2



## bryn1u (Apr 11, 2010)

Hello.

I have a panel which need ssh2. Its diffcult to find some good guide about ssh2.
I installed security/ssh2 from ports and what next ? If i using ssh i should turnf off ssh and turn on ssh2 ? ssh2=ssh i mean funcionality ? How to go about it ? I found a few manuals but there are for linux. It is not suitable for use. 

Thanks. Greet.


----------



## sixtydoses (Apr 11, 2010)

Both are using port 22(by default), so turn off ssh if you wish to use ssh2. Add `sshd2_enable="YES"` in your /etc/rc.conf, or start it for the first time by running `# /usr/local/etc/rc.d/sshd2 onestart`.

sshd2_config().


----------



## DutchDaemon (Apr 11, 2010)

On FreeBSD, the base system ssh/sshd (OpenSSH) is ssh v2. The one from ports is simply the one made by ssh.com (free version of commercial software, and I think no longer maintained or updated). So if you need "SSH version 2", simply use the base system's ssh/sshd.


----------



## sixtydoses (Apr 11, 2010)

Ah DD is fast, I just read somewhere in the mailing list about ^^.


----------



## bryn1u (Apr 11, 2010)

```
swift# /usr/local/etc/rc.d/sshd2 start
Generating 2048-bit dsa key pair
   3 o.oOo.oOOo.o
Key generated.
DSA hostkey
Private key saved to /usr/local/etc/ssh2/hostkey
Public key saved to /usr/local/etc/ssh2/hostkey.pub
Starting sshd2.
/usr/local/etc/rc.d/sshd2: WARNING: failed to start sshd2
```

Hmm. I thnik it will be long way ...

#edit

I forgot turn off ssh.


```
/etc/rc.d/sshd2 onestop - OK
/usr/local/etc/sshd2 onestart - OK
```

But i still cant connect with ssh2 . Why ? Whats wrong ?


----------



## DutchDaemon (Apr 11, 2010)

Why do you need sshd2 from ports? Maybe you should think about that (see post #3) first.


----------



## bryn1u (Apr 11, 2010)

```
Checking for SSH2 extension . . . . . [ NOT INSTALLED ]
Read documentation about installing SSH2 or contact support for free web hosting.
SSH2 is required to communicate with the game servers.
You may continue with SWIFT Panel install, if you wish, and install SSH2 later.
```

As u see i can't still install ssh2. What should i do ? What am i suppose to do ?

I found something:

http://www.sourceforge.net/projects/libssh2 


```
cd libssh2
./configure
make
make install
```

http://pecl.php.net/package/ssh2


```
phpize
./configure
make
make install
make test
```


```
swift# make test

Build complete.
Don't forget to run 'make test'.


+-----------------------------------------------------------+
|                       ! ERROR !                           |
| The test-suite requires that you have pcre extension      |
| enabled. To enable this extension either compile your PHP |
| with --with-pcre-regex or if you've compiled pcre as a    |
| shared module load it via php.ini.                        |
+-----------------------------------------------------------+
```
I checked in php5-extension and i have it, php5-extension is with pcre option (Perl Compatible Regular Expression support). After rehash www i still got 
	
	



```
Checking for SSH2 extension . . . . . [ NOT INSTALLED ].
```

Someone can help me ?


----------



## bryn1u (Apr 11, 2010)

Ok. I DID IT !

Firstly:

```
wget [url]http://voxel.dl.sourceforge.net/sourceforge/libssh2/libssh2-1.0.tar.gz[/url]
 tar -zxvf libssh2-1.0.tar.gz
 cd libssh2-1.0
 ./configure --with-openssl
 make
 make install
```

Secondly


```
wget [url]http://gamepanelx.com/files/ssh2-0.10-modified.tar.gz[/url]
 tar -zxvf ssh2-0.10-modified.tar.gz
 cd ssh2-0.10
 phpize && ./configure --with-ssh2 && make
```

U should check if u have ssh2.so:

```
localhost# locate ssh2.so
/usr/local/lib/libssh2.so
/usr/local/lib/libssh2.so.1
/usr/local/lib/php/20060613/ssh2.so
```

/usr/local/lib/php/20060613/ssh2.so
Thats correct.

And edit:

```
/usr/local/etc/php.ini
```

search for 'Dynamic Extensions' and put there extension=ssh2.so right below that.

I installed libssh2 from ports too. But i dont know if this is need it.

```
localhost# whereis libssh2
libssh2: /usr/ports/security/libssh2
localhost#make install clean
```

And finally:


```
Checking for SSH2 extension . . . . . [ INSTALLED ]
```


----------



## phoenix (Apr 13, 2010)

Or, you can do it the FreeBSD way, using the ports tree:  security/libssh2


----------



## bryn1u (Apr 13, 2010)

Exaclly. I found it in port. I need libssh2 to connect php with ssh. 

Before install u have to install, mysql50-server, mysql50-client, apache22, php5, php5-extension, proftpd  (add curl, libssh, ftp/sftp extension options.)

And it should be work.

Greet.


----------



## snagglepuss (Apr 13, 2010)

That sounds like a complete hassle.  I'm almost wondering if it wouldn't be easier to just use phpseclib, a pure PHP SSH2 implementation.


----------



## bryn1u (Apr 13, 2010)

http://www.swiftpanel.com/  I want to install.

```
Requirements
Web Server

    * Linux Operating System (CentOS 5 Recommended)
    * PHP 5 (PHP 5.2.8 Recommended)
    * MySQL Database
    * Curl Support
    * FTP Extension
    * SSH2 Extension (Instructions Included)
```


----------

