Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-08-2010
Member
 
Join Date: Aug 2010
Posts: 55
Linux bash script for telnet connection

Hello,
I'm looking to make a bash script that connects with telnet running a command on the remote server and retrieve the file created (It has limit, I can open a ftp connection to retrieve the file behind). And more information is passed as parameter of the program:
Code:
test_prog.sh <serveurdist> <login> <passwd> <deb>
I have it but it does not work (I think I'm missing the options to connect directly without requiring authentication to connect to the server. Any help regarding this will be appreciated. Thank you.
Reply With Quote
  #2  
Old 23-08-2010
Member
 
Join Date: Sep 2005
Posts: 1,365
Re: Linux bash script for telnet connection

Tip to execute a command on a remote server, when that was accessible from a telnet but can not want to put services (rlogin, rsh, rexec) in place
on the remote server.

1) Make a script containing the transactions would be done manually
by telnet. (Example Script action.scr "below)
Code:
# / Bin / sh 
sleep 2 
echo "user connection" 
sleep 1 
echo "password" 
sleep 1 
echo "command 1" 
sleep 1 
echo "No Control" 
sleep 1 
echo "exit"
Note (1): The "sleep 1" is important on Linux platforms otherwise the script is too fast is the telnet sees not pass the instructions. Increase the value of sleep following the order if it a long delay in reply.

Note (2): Do not forget to put the rights of execution on the script (chmod 777 action.scr)

2) Then run the script redirects to the telnet
Example:
Code:
Action.scr # sh | telnet IPaddress
Result: telnet connection with enforcement of orders 'echo "order"'
script "action.scr" (as manual way ").
Reply With Quote
  #3  
Old 23-08-2010
Member
 
Join Date: Aug 2010
Posts: 55
Re: Linux bash script for telnet connection

The problem I have for the moment that it can not authenticate correctly. I manage to access the server, but it puts me directly after the remote server terminated the connection (it does not even that). Otherwise like find walking very well, I already tried everything in hand and everything works.
Reply With Quote
  #4  
Old 23-08-2010
Member
 
Join Date: Apr 2008
Posts: 3,423
Re: Linux bash script for telnet connection

I proposed to the rexec instead of your telnet:
Code:
rexec [username @ hostname] [-DNN] [-l username] [-p password] command
And command, you put
Code:
"Cd $ 4; find.-Type d-exec echo () \;> arbo.txt"
This should work. Do not worry about not being noticed you just go with your code.
Reply With Quote
  #5  
Old 23-08-2010
Member
 
Join Date: Aug 2010
Posts: 39
Re: Linux bash script for telnet connection

Even i have a similar kind of a issue with my script, well then I tried in every way - in case I made a mistake - I checked what I typed several times and I read the man with extensively.
So I have this code:
Code:
echo "test" root @ sertst rexec-l login-p passwd "find.-type> arbo.txt" echo "End Test"
But it asks for more password and answer me this:
Code:
Password: rexec: Error in rexec system call rexec: (The system error FOLLOWING Itself May Be in error) rexec: Success
I have no idea regarding this error, if you can help me with this it would be great.
Reply With Quote
  #6  
Old 23-08-2010
Member
 
Join Date: Dec 2005
Posts: 941
Re: Linux bash script for telnet connection

Hello,
I know that I tried to telnet like this and finally I am back on the rexec. But I think there are limitations and different versions of the OS according to rexec, including the fact of passing the password parameter. I guess I am correct here and you have understood what I am trying to say.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Linux bash script for telnet connection"
Thread Thread Starter Forum Replies Last Post
How to create CGI script in bash? Mulan Software Development 5 01-09-2010 08:19 PM
Linux bash script with the command w Trini Alvarado Operating Systems 4 22-03-2010 12:11 PM
Create bash script for ftp teenQ Operating Systems 4 04-03-2010 07:37 PM
Bash script for internet connection in Ubuntu Callium Operating Systems 5 23-01-2010 05:42 PM
Bash script if then else help Unix'EM Software Development 3 18-08-2009 06:34 PM


All times are GMT +5.5. The time now is 11:04 PM.