Package x2go :: Package backends :: Package control :: Module _stdout :: Class X2goControlSessionSTDOUT
[frames] | no frames]

Class X2goControlSessionSTDOUT

source code

        object --+    
                 |    
paramiko.SSHClient --+
                     |
                    X2goControlSessionSTDOUT

STILL UNDOCUMENTED

Instance Methods
 
__init__(self, profile_name='UNKNOWN', add_to_known_hosts=False, known_hosts=None, terminal_backend=<class 'x2go.backends.terminal._stdout.X2goTerminalSessionSTDO..., info_backend=<class 'x2go.backends.info._stdout.X2goServerSessionInfoSTDOUT'>, list_backend=<class 'x2go.backends.info._stdout.X2goServerSessionListSTDOUT'>, proxy_backend=<class 'x2go.backends.proxy._nx3.X2goProxyNX3'>, client_rootdir='/home/buildd/.x2goclient', sessions_rootdir='/home/buildd/.x2go', ssh_rootdir='/home/buildd/.ssh', logger=None, loglevel=56, *args, **kwargs)
Initialize an X2go session.
source code
 
load_session_host_keys(self) source code
 
__del__(self) source code
 
is_x2gouser(self, username) source code
 
remote_username(self)
Returns the control session's remote username.
source code
 
set_profile_name(self, profile_name) source code
 
check_host(self, hostname, port=22)
Wraps around a Paramiko/SSH host key check.
source code
 
connect(self, hostname, port=22, username='', password='', pkey=None, use_sshproxy=False, sshproxy_host='', sshproxy_user='', sshproxy_password='', sshproxy_key_filename='', sshproxy_tunnel='', key_filename=None, timeout=None, allow_agent=False, look_for_keys=False, session_instance=None, add_to_known_hosts=False, force_password_auth=False)
Connect to an X2go server and authenticate to it.
source code
 
dissociate(self, terminal_session)
STILL UNDOCUMENTED
source code
 
disconnect(self)
STILL UNDOCUMENTED
source code
 
is_alive(self) source code
 
start(self, **kwargs)
Start a new X2go session.
source code
bool
resume(self, session_name=None, session_instance=None, **kwargs)
Resume a running/suspended X2go session.
source code
bool
share_desktop(self, desktop=None, user=None, display=None, share_mode=0, **kwargs)
Share another already running desktop session.
source code
list
list_desktops(self, raw=False, maxwait=20)
List all desktop-like sessions of current user (or of users that have granted desktop sharing) on the connected server.
source code
X2goServerSessionList instance or str
list_sessions(self, raw=False)
List all sessions of current user on the connected server.
source code
 
clean_sessions(self)
Find X2go terminals that have previously been started by the connected user on the remote X2go server and terminate them.
source code
bool
is_connected(self)
Returns True if this X2go session is connected to the remote server (that is if it has a valid Paramiko Transport object).
source code
bool
is_running(self, session_name)
Returns True if the given X2go session is in running state, False else.
source code
bool
is_suspended(self, session_name)
Returns True if the given X2go session is in suspended state, False else.
source code
bool
has_terminated(self, session_name)
Returns True if this X2go session is not in the session list on the connected server, False else.
source code
bool
suspend(self, session_name)
Suspend either this or another available X2go session on the connected server.
source code
bool
terminate(self, session_name)
Terminate either this or another available X2go session on the connected server.
source code

Inherited from paramiko.SSHClient: close, exec_command, get_host_keys, get_transport, invoke_shell, load_host_keys, load_system_host_keys, open_sftp, save_host_keys, set_log_channel, set_missing_host_key_policy

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  associated_terminals = None
Properties

Inherited from object: __class__

Method Details

__init__(self, profile_name='UNKNOWN', add_to_known_hosts=False, known_hosts=None, terminal_backend=<class 'x2go.backends.terminal._stdout.X2goTerminalSessionSTDO..., info_backend=<class 'x2go.backends.info._stdout.X2goServerSessionInfoSTDOUT'>, list_backend=<class 'x2go.backends.info._stdout.X2goServerSessionListSTDOUT'>, proxy_backend=<class 'x2go.backends.proxy._nx3.X2goProxyNX3'>, client_rootdir='/home/buildd/.x2goclient', sessions_rootdir='/home/buildd/.x2go', ssh_rootdir='/home/buildd/.ssh', logger=None, loglevel=56, *args, **kwargs)
(Constructor)

source code 

Initialize an X2go session. With the X2goControlSessionSTDOUT class you can start new X2go sessions, resume suspended sessions or suspend resp. terminate currently running sessions on a connected X2go server.

Parameters:
Overrides: object.__init__

connect(self, hostname, port=22, username='', password='', pkey=None, use_sshproxy=False, sshproxy_host='', sshproxy_user='', sshproxy_password='', sshproxy_key_filename='', sshproxy_tunnel='', key_filename=None, timeout=None, allow_agent=False, look_for_keys=False, session_instance=None, add_to_known_hosts=False, force_password_auth=False)

source code 

Connect to an X2go server and authenticate to it. This method is directly inherited from the paramiko.SSHClient module. The features of the Paramiko SSH client connect method are recited here. The parameters add_to_known_hosts and force_password_auth have been added as a parameter for X2go.

The server's host key is checked against the system host keys (see load_system_host_keys) and any local host keys (load_host_keys). If the server's hostname is not found in either set of host keys, the missing host key policy is used (see set_missing_host_key_policy). The default policy is to reject the key and raise an SSHException.

Authentication is attempted in the following order of priority:

  • The pkey or key_filename passed in (if any)
  • Any key we can find through an SSH agent
  • Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/
  • Plain username/password auth, if a password was given

If a private key requires a password to unlock it, and a password is passed in, that password will be used to attempt to unlock the key.

Parameters:
  • hostname (str) - the server to connect to
  • port (int) - the server port to connect to
  • username (str) - the username to authenticate as (defaults to the current local username)
  • password (str) - a password to use for authentication or for unlocking a private key
  • pkey (PKey) - an optional private key to use for authentication
  • key_filename (str or list(str)) - the filename, or list of filenames, of optional private key(s) to try for authentication
  • timeout (float) - an optional timeout (in seconds) for the TCP connect
  • allow_agent (bool) - set to False to disable connecting to the SSH agent
  • look_for_keys (bool) - set to False to disable searching for discoverable private key files in ~/.ssh/
  • add_to_known_hosts (bool) - non-paramiko option, if True paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to False paramiko.RejectPolicy() is used
  • force_password_auth (bool) - non-paramiko option, disable pub/priv key authentication completely, even if the pkey or the key_filename parameter is given
  • session_instance (instance) - an instance X2goSession using this X2goControlSessionSTDOUT instance.
Raises:
  • BadHostKeyException - if the server's host key could not be verified
  • AuthenticationException - if authentication failed
  • SSHException - if there was any other error connecting or establishing an SSH session
  • socket.error - if a socket error occurred while connecting
Overrides: paramiko.SSHClient.connect

start(self, **kwargs)

source code 

Start a new X2go session.

The X2goControlSessionSTDOUT.start() method accepts any parameter that can be passed to any of the X2goTerminalSession backend class constructors.

resume(self, session_name=None, session_instance=None, **kwargs)

source code 

Resume a running/suspended X2go session.

The X2goControlSessionSTDOUT.resume() method accepts any parameter that can be passed to any of the X2goTerminalSession backend class constructors.

Returns: bool
True if the session could be successfully resumed

share_desktop(self, desktop=None, user=None, display=None, share_mode=0, **kwargs)

source code 

Share another already running desktop session. Desktop sharing can be run in two different modes: view-only and full-access mode.

Parameters:
  • desktop (str) - desktop ID of a sharable desktop in format <user>@<display>
  • user (str) - user name and display number can be given separately, here give the name of the user who wants to share a session with you.
  • display (str) - user name and display number can be given separately, here give the number of the display that a user allows you to be shared with.
  • share_mode (int) - desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS.
Returns: bool
True if the session could be successfully shared.

list_desktops(self, raw=False, maxwait=20)

source code 

List all desktop-like sessions of current user (or of users that have granted desktop sharing) on the connected server.

Parameters:
  • raw (bool) - if True, the raw output of the server-side X2go command x2godesktopsharing is returned.
Returns: list
a list of X2go desktops available for sharing

list_sessions(self, raw=False)

source code 

List all sessions of current user on the connected server.

Parameters:
  • raw (bool) - if True, the raw output of the server-side X2go command x2golistsessions is returned.
Returns: X2goServerSessionList instance or str
normally an instance of a X2goServerSessionList backend Bis returned. However, if the raw argument is set, the plain text output of the x2golistsessions command is returned

is_connected(self)

source code 

Returns True if this X2go session is connected to the remote server (that is if it has a valid Paramiko Transport object).

Returns: bool
X2go session connected?

is_running(self, session_name)

source code 

Returns True if the given X2go session is in running state, False else.

Parameters:
  • session_name (str) - X2go name of the session to be queried
Returns: bool
X2go session running?

is_suspended(self, session_name)

source code 

Returns True if the given X2go session is in suspended state, False else.

Returns: bool
X2go session suspended?

has_terminated(self, session_name)

source code 

Returns True if this X2go session is not in the session list on the connected server, False else.

Of course, if this command is called before session startup, it will also return True.

Returns: bool
X2go session has terminate?

suspend(self, session_name)

source code 

Suspend either this or another available X2go session on the connected server.

If session_name is given, X2goControlSessionSTDOUT.suspend() tries to suspend the corresponding session.

Parameters:
  • session_name (str) - X2go name of the session to be suspended
Returns: bool
True if the session could be successfully suspended

terminate(self, session_name)

source code 

Terminate either this or another available X2go session on the connected server.

If session_name is given, X2goControlSessionSTDOUT.terminate() tries to terminate the corresponding session.

Parameters:
  • session_name (str) - X2go name of the session to be terminated
Returns: bool
True if the session could be successfully terminate