"PHP ssh2 auth pubkey file()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-== 참고 자료 == +==참고==))
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
3번째 줄: 3번째 줄:
* 공개키를 이용하여 SSH 인증하는 PHP 함수
* 공개키를 이용하여 SSH 인증하는 PHP 함수


<source lang='php'>
<syntaxhighlight lang='php'>
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'username',
if (ssh2_auth_pubkey_file($connection, 'username',
12번째 줄: 12번째 줄:
   die('Public Key Authentication Failed');
   die('Public Key Authentication Failed');
}
}
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:35 판

1 개요

PHP ssh2_auth_pubkey_file()
  • 공개키를 이용하여 SSH 인증하는 PHP 함수
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'username',
                          '/home/username/.ssh/id_rsa.pub',
                          '/home/username/.ssh/id_rsa', 'secret')) {
  echo "Public Key Authentication Successful\n";
} else {
  die('Public Key Authentication Failed');
}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}