File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -9,5 +9,7 @@ before_script:
9
9
- lsb_release -a
10
10
- sudo apt-get update && sudo apt-get install libssh2-1 -y
11
11
- echo "extension=ssh2.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
12
+ - ssh-keygen -N '' -f ~/.ssh/id_rsa
13
+ - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
12
14
13
- script : php -m | grep ssh2
15
+ script : php sample_connect.php
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ $ connection = ssh2_connect ('localhost ' , 22 , ['hostkey ' =>'ssh-rsa ' ]);
4
+
5
+ if (ssh2_auth_pubkey_file ($ connection , 'root ' ,
6
+ '/home/travis/.ssh/id_rsa.pub ' ,
7
+ '/home/travis/.ssh/id_rsa ' )) {
8
+ echo "Public Key Authentication Successful \n" ;
9
+ } else {
10
+ die ('Public Key Authentication Failed ' );
11
+ }
You can’t perform that action at this time.
0 commit comments