Do you need to ssh/sftp into servers and get tired of always typing ssh user@some-connection.org
? Or worse having to type an IP address?
This console application will allow you to define connections you make frequently to connect as easy as connect e
Using Composer
$ composer global require taylornetwork/server-connector
Config files will be published to ~/ServerConnector/config/
Note: if config files are not automatically published run the config:publish
command.
$ server-connector config:publish
Defines the default connection type if omitted.
// defaults.php
return [
'type' => 'ssh',
];
This is where you define all your server connections.
By default:
// connections.php
return [
// Name of the connection as the key
'example' => [
// Add any short aliases to access this as
'aliases' => [ 'ex', 'e' ],
// Add credentials here, or an empty array
'credentials' => [
'username' => 'user1',
// Password is not recommended, ideally omit this and use ssh keys
'password' => 'password1',
],
// Omit to use default or you can set the path to a private key
'keyFile' => '~/.ssh/id_rsa',
// URL or IP address to connect to
'url' => 'connect.example.com',
],
];
Add your connections in the array that will be returned.
Once you have defined some connections you can run
$ server-connector connect ConnectionNameOrAlias
Which will connect to the connection with the default connection type
Alternatively
$ server-connector connect sftp ConnectionNameOrAlias
To connect via SFTP if it isn't the default.
To add a function to your ~/.profile
to call server-connector
you can use
$ server-connector register
By default it will register a function connect()
in your ~/.profile
you can specify the function name by
$ server-connector register FunctionName
After running this command you will need to source your ~/.profile
or restart your terminal application.
With the BASH function you can call this application by
connect ConnectionNameOrAlias