in reply to Re^2: ssh not working
in thread ssh not working
If you login to a remote machine, your login shell is spawned - one of sh, ksh, bash, csh, tcsh. You can lookup ypur shell in the file /etc/passwd on the remote machine. Please consult the login manual page of the remote system for details on the login process, and the manual page for your login shell for it's startup sequence.
On startup, the login shell processes various rc files to set $PATH, the value of $TERM, the height and width of the terminal, system wide aliases for commands and so on.
If such code as setting up the terminal is carried out regardless whether there was a controlling terminal (pty) set up for this session, various commands to set up the environment could hang. E.g. a shell could ask for your terminal type at the command prompt, if it is unable to determine it from the environment.
Depending on the shell and remote system, the shell startup files are one ore more of /etc/profile, /etc/bashrc, /etc/csh.csh, $HOME/.profile, $HOME/.bashrc, $HOME/.cshrc etc. Check if those files contain terminal initialization code, and if possible, disable it.
Since Net::SSH::W32Perl doesn't support the shell method, there should be no pty allocated, but you can explicitly disable it.
Try the following:
use Net::SSH::W32Perl; my $ssh = Net::SSH::W32Perl->new($host, debug => 1, use_pty => 0, ); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("ls");
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: ssh not working
by veeruch (Sexton) on Jul 05, 2006 at 14:31 UTC | |
by Anonymous Monk on Feb 20, 2007 at 17:44 UTC |