468,321 Members | 1,757 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Trying to use Net::SSH::Expect

Hi,

I am trying to use Net::SSH::Expect.

Basically I had success login into a remote server using this module.

The thing is i think i have a syntax problem...

I am logging into a remote server using ssh and trying to edit a file so this is waht i do:
Expand|Select|Wrap|Line Numbers
  1. $ssh->exec("sed 's/\/user/\#\/user/' /etc/auto.master > /etc/auto.master.new");
  2. $ssh->exec("rm -fr /etc/auto.master");
  3. $ssh->exec("mv /etc/auto.master.new /etc/auto.master");
  4.  
for some reason the first line (sed) fails, and i don't know why,,,


Any one has an idea??

Thanks!
Jul 16 '08 #1
3 4416
numberwhun
3,503 Expert Mod 2GB
On the remote machine, have you tried executing that sed command to ensure that it works as expected and isn't throwing any errors?

Also, what does it say when it fails?


Regards,

Jeff
Jul 16 '08 #2
Hi,

Yes of course I tried it, and it worked.

Any way the code had to be modified into this :

$ssh->exec("sed 's,/user,#\/user,' /etc/auto.master > /etc/auto.master.new");

Now it works.
Jul 17 '08 #3
It's possible that you need to enable raw_pty in the login block. The author's release notes on cpan mentions that it sometimes resolves pty compatability issues. I'm still trying to figure it out myself, though. If I could just figure out a way to increase the login timeout interval! Good luck.

-Justin
Jul 30 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by blob | last post: by
8 posts views Thread by supercomputer | last post: by
5 posts views Thread by Jesse Charbneau | last post: by
6 posts views Thread by Dennis D. | last post: by
10 posts views Thread by =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?= | last post: by
1 post views Thread by rahatekarabhijeet | last post: by
2 posts views Thread by Gil_H | last post: by
8 posts views Thread by John Salerno | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.