yanne / api-test

0 stars 0 forks source link

Seems SSHLibrary couldn't switch to root user successfully #65

Closed yanne closed 10 years ago

yanne commented 10 years ago
  1. I login a remote server as user A with self._ssh.login(username,password)
  2. I try to switch to root user with below commands self._ssh.write("su -") self._ssh.read_until("Password: ") self._ssh.write(self._password) self._ssh.set_prompt("# ") No error after executing the commands.
  3. Print the current user print self._ssh.execute_command("whoami")

    The result is A, not root. Anyone meets the same problem? Thanks

This issue was originally opened at Google Code on Mar 14, 2013.

yanne commented 10 years ago

Original comment by robotframework@gmail.com on Jul 31, 2013.

This happens because Execute Command keyword executes the command in a new session. Thus changes to the session you've done earlier are not visible.

yanne commented 10 years ago

Original comment by lsy2...@163.com on Aug 23, 2013.

Have a way to do that change the user in same session? At 2013-07-31 22:51:34,robotframework-sshlibrary@googlecode.com wrote: