private function login()
    {
        if ($this->loggedIn) {
            return;
        }

        if (array_key_exists('rsakey', $this->sshConfig)) {
            $this->loginWithRsaKey();
        } elseif (array_key_exists('password', $this->sshConfig)) {
            $this->loginWithPassword();
        }

        $this->loggedIn = $this->validate();
    }