sshspawner/sshspawner.py
def spawn_as_user(self, cmd, timeout=15):
        """Run pexpect as the user spawning the notebook

        This method attaches kerberos credentials to the command env if they
        exist.
        """

        user = pwd.getpwnam(self.user.name)
        uid = user.pw_uid
        env = os.environ
        krb_files = glob(f"/tmp/krb5cc_{uid}*")
        if krb_files:
            env["KRB5CCNAME"] = max(krb_files, key=os.path.getctime)

        popen_kwargs = dict(
            env=env,
            timeout=timeout,
            encoding="utf-8",
            preexec_fn=self.make_preexec_fn(self.user.name),
        )

        self.log.debug(f"Running: {cmd} as {self.user.name}")
        return popen_spawn.PopenSpawn(cmd, **popen_kwargs)
Run pexpect as the user spawning the notebook

        This method attaches kerberos credentials to the command env if they
        exist.
        
Run pexpect as the user spawning the notebook
This method attaches kerberos credentials to the command env if they
exist.
Run pexpect as the user spawning the notebook This method attaches kerberos credentials to the command env if they exist .
def spawn_as_user(self, cmd, timeout=15):
        user = pwd.getpwnam(self.user.name)
        uid = user.pw_uid
        env = os.environ
        krb_files = glob(f"/tmp/krb5cc_{uid}*")
        if krb_files:
            env["KRB5CCNAME"] = max(krb_files, key=os.path.getctime)
        popen_kwargs = dict(
            env=env,
            timeout=timeout,
            encoding="utf-8",
            preexec_fn=self.make_preexec_fn(self.user.name),
        )
        self.log.debug(f"Running: {cmd} as {self.user.name}")
        return popen_spawn.PopenSpawn(cmd, **popen_kwargs)
def spawn_as_user ( self , cmd , timeout = 15 ) : user = pwd . getpwnam ( self . user . name ) uid = user . pw_uid env = os . environ krb_files = glob ( f"/tmp/krb5cc_{uid}*" ) if krb_files : env [ "KRB5CCNAME" ] = max ( krb_files , key = os . path . getctime ) popen_kwargs = dict ( env = env , timeout = timeout , encoding = "utf-8" , preexec_fn = self . make_preexec_fn ( self . user . name ) , ) self . log . debug ( f"Running: {cmd} as {self.user.name}" ) return popen_spawn . PopenSpawn ( cmd , ** popen_kwargs )
Run pexpect as the user spawning the notebook
This method attaches kerberos credentials to the command env if they
exist.
Run pexpect as the user spawning the notebook This method attaches kerberos credentials to the command env if they exist .
"""Run pexpect as the user spawning the notebook

        This method attaches kerberos credentials to the command env if they
        exist.
        """
self
cmd
timeout