Browsing articles tagged with " SSH"
Feb
6
2013

PHP + SSH Authentication using a public key

  <?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’); } ?>   This is a known bug in php: password protected private key cannot be used on certain combinaisons. See: https://bugs.php.net/bug.php?id=58573 ssh2_auth_pubkey_file() is broken when the public key file is protected with a password AND libssh2 is compiled with libgcrypt, which is what debian/ubuntu and probably others do. I’m working on a solution for this bug, but if you need this working rebuild libssh2 yourself with […]

Feb
6
2013

Installing PHP’s SSH2 extension on Ubuntu

    On Ubuntu 10.04 LTS, Do this (there’s no need to do any compiling anymore) 1 apt-get install libssh2-1-dev libssh2-php You can now test if PHP recognizes it’s new ssh2 extension by running: 1 php -m |grep ssh2 Don’t forget to restart Apache 1 service apache2 restart

Apr
30
2012

Using sudo, ssh, rsync on the Official Ubuntu Images for EC2

ubuntu

The official Ubuntu images for EC2 do not allow ssh directly to the root account, but instead provide access through a normal “ubuntu” user account. This practice fits the standard Ubuntu security model available in other environments and, admittedly, can take a bit of getting used to if you are not familiar with it. This document describes how to work inside this environment using the “ubuntu” user and the sudo utility to execute commands as […]

Apr
30
2012

SSH Automatic Login

terminal

Of course this is not the right phrase for it. It should be something like “key-based authorization with SSH”. Or simply “publickey authorization”. Or “unattended ssh login”. But I guess you know what I mean. Here are the steps: Create a public ssh key, if you haven’t one already. Look at ~/.ssh. If you see a file named id_dsa.pub then you obviously already have a public key. If not, simply create one. ssh-keygen -t dsa […]




Member Area