diff options
-rw-r--r-- | paramiko/channel.py | 10 | ||||
-rw-r--r-- | paramiko/client.py | 5 | ||||
-rw-r--r-- | sites/www/changelog.rst | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py index 7689b266..3b6a59df 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -292,6 +292,10 @@ class Channel (ClosingContextManager): This operation is additive - i.e. the current environment is not reset before the given environment variables are set. + .. warning:: + Servers may silently reject some environment variables; see the + warning in `set_environment_variable` for details. + :param dict environment: a dictionary containing the name and respective values to set :raises SSHException: @@ -310,6 +314,12 @@ class Channel (ClosingContextManager): """ Set the value of an environment variable. + .. warning:: + The server may reject this request depending on its ``AcceptEnv`` + setting; such rejections will fail silently (which is common client + practice for this particular request type). Make sure you + understand your server's configuration before using! + :param str name: name of the environment variable :param str value: value of the environment variable diff --git a/paramiko/client.py b/paramiko/client.py index 978bde51..40cd5cf2 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -421,6 +421,11 @@ class SSHClient (ClosingContextManager): :param dict environment: a dict of shell environment variables, to be merged into the default environment that the remote command executes within. + + .. warning:: + Servers may silently reject some environment variables; see the + warning in `.Channel.set_environment_variable` for details. + :return: the stdin, stdout, and stderr of the executing command, as a 3-tuple diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 496544ef..02421988 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -20,7 +20,8 @@ Changelog `Channel.set_environment_variable <paramiko.channel.Channel.set_environment_variable>` methods) which implements the ``env`` SSH message type. This means the remote shell - environment can be set without the use of ``VARNAME=value`` shell tricks. + environment can be set without the use of ``VARNAME=value`` shell tricks, + provided the server's ``AcceptEnv`` lists the variables you need to set. Thanks to Philip Lorenz for the pull request. * :support:`819 backported (>=1.15,<2.0)` Document how lacking ``gmp`` headers at install time can cause a significant performance hit if you build PyCrypto |