Dhouard
Dhouard

Reputation: 175

How to configure laravel in order to used ssh keys

I'm developing a laravel application and I need to upload some files over ssh.

Until now I've been able to do it suplying an user and password to log into ssh server in the app/config/remote.php file. It looks like this:

'connections' => array(

        'production' => array(
            'host'      => '',
            'username'  => '',
            'password'  => '',
            'key'       => '',
            'keyphrase' => '',
            'root'      => '/var/www',
        ),
                'staging' => array(
                        'host'      => 'localhost',
                        'username'  => 'dhouard',
                        'password'  => 'somepasswordhere',
                        'key'       => '',
                        'keyphrase' => '',
                        'root'      =>  '/home/dhouard',

                ),

    ),

When I do

SSH::into('staging')->put('somepath/somefile', 'remotepath/remotefile')

The files are uploaded fine. But I need to use a key and a keyphrase but I don't know how to do it.

I googled for a while but I cannot find any tutorial to do this.

Can anyone tell me the steps?.

Upvotes: 2

Views: 1931

Answers (2)

zaboca
zaboca

Reputation: 41

I was looking around for this as well. Here's what I found to work.

In the key field within the remote.php config file, you're entering the path to your private key.

Upvotes: 0

bobbybackblech
bobbybackblech

Reputation: 1886

You could add your SSH key to known hosts on your server which would make you able to ssh into the server without a password.

Upvotes: 1

Related Questions