By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,234 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

Trying to use Net::SSH::Expect

P: 2
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
Share this Question
Share on Google+
3 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
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

P: 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

P: 1
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.