473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 4582
numberwhun
3,509 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

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

Similar topics

3
by: blob | last post by:
Hi all, Below is my script that will be used to connect to a remote host and change my password automatically: =========================================== #!/usr/bin/perl use strict();
8
by: supercomputer | last post by:
I have a script that I cycle through nodes connect to them and run uptime to get some information. I run the script as root so it doesn't require a password on the rest of the nodes. It does...
5
by: Jesse Charbneau | last post by:
Hi Everyone, If I'm posting to the wrong group, please let me know. I have an application that I am writing to communicate from a Windows host to a UNIX server via SSH. What I would like to...
6
by: Dennis D. | last post by:
1. Planet-Source-Code has a 'compatibility filter' that asks for a e-mail/password, which then transfers the user to another site, rent-a-coder. This seems deceptive to me. At any rate, there is no...
4
by: cpptutor2000 | last post by:
Could some C guru help me please? I am using the following program to open a SSH connection to a remote host and eventually run a program on that remote host. #include <stdio.h> #include...
10
by: =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?= | last post by:
I want to use Python to connect to a SSH account over a HTTP proxy to automate some operations. I thought paramiko would be able to do that, but it can not (it seems). Is there some other Python...
1
by: rahatekarabhijeet | last post by:
i am trying to autotmate the ssh on my machine using perl script with expect module, i seen the script at thread575170.html from same site discussion & run the script but it giving me yes/no prompt...
2
by: Gil_H | last post by:
Hi, I'm trying to run a script over unix on a remote machine. In order to automate it, the procedure requests the following: 1. Using SSH connection. 2. Operating a command on the remote...
8
by: John Salerno | last post by:
Generally speaking, what tools would I use to do this? Is there a built-in module for it? I looked at the telnetlib module, but the documentation wasn't really complete enough for me to get a good...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.