| Ubuntu This forum is for the discussion of Ubuntu Linux. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-04-2012, 07:38 PM
|
#1
|
|
LQ Newbie
Registered: Dec 2011
Posts: 8
Rep: 
|
i want to create a script for automatic login through telent
Hi all,
please help me our here.
i have ubuntu desktop.
i use to login into my server through.
there are many server like this.
i want script for automatic login. ( script should enter automation uid/pwd)
logs are below.
#########################################################################
eashuku@GH4WVQ1:~$ telnet 150.236.xx.xx
IN-XXXXXX login: test
Password: test
Last login: Sat May 5 05:47:48 UTC 2012 from 169.144.8.16 on pts/0
############################## XXXXXXXXX #########################################
This System is for authorized users only. All activity is logged and regulary checked by systems personal.
Individuals using this system without authority are subjected to having all their services revoked.
####################################################################################################
test@IN-XXXXXX:~> mdsh
MDSH>
|
|
|
|
05-04-2012, 08:04 PM
|
#2
|
|
Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 699
Rep: 
|
This is pretty much what expect was designed for. Install it if you don't have it and it's trivial to script telnet login.
|
|
|
|
05-05-2012, 11:31 AM
|
#3
|
|
LQ Newbie
Registered: Dec 2011
Posts: 8
Original Poster
Rep: 
|
I need simple bin/bash script !
Last edited by ashu_ky; 05-05-2012 at 12:07 PM.
|
|
|
|
05-05-2012, 11:37 AM
|
#4
|
|
Moderator
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 12,190
|
1. Yelling at people will make them less likely to help you.
2. There is no simple bash script to do this with telnet
3. telnet is outdated and totally insecure. Switch to SSH and use key-based authentication (recommended anyways), this way you don't need to type in a password and can use simple scripts to automate tasks.
|
|
|
|
05-05-2012, 11:38 AM
|
#5
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,802
|
you will never get a simple bash script because telnet requires interactivity (so you need to wait for a prompt, send username, wait for another string, send password and finally you will need to send the command and wait for the answer). Bash is not designed to do that. The program you need is named expect.
From the other hand you can do it easily with ssh, instead of telnet.
|
|
|
|
05-05-2012, 12:23 PM
|
#6
|
|
Guru
Registered: Mar 2008
Posts: 8,547
|
autoexpect is on may distro's. It tends to work fine for creating such scripts.
Makes a expect script as easy as can be.
|
|
|
|
05-05-2012, 12:23 PM
|
#7
|
|
LQ Newbie
Registered: Dec 2011
Posts: 8
Original Poster
Rep: 
|
okay buddy,
please tell me.
ssh user@150.xx.xx.xx with password test.
what should be script?
my scipt
!bin/bash
ssh user@150.xxxxxx
echo pasword;
------------------------------> not working 
|
|
|
|
05-05-2012, 12:33 PM
|
#8
|
|
Moderator
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 12,190
|
As said already before, use key-based authentication and you don't need to type in a password.
|
|
|
|
05-05-2012, 12:52 PM
|
#9
|
|
LQ Newbie
Registered: Dec 2011
Posts: 8
Original Poster
Rep: 
|
Dear friend,
my limitation is that , i can not make any change in server and as well as i don't have root access on client machine. anyways i can use Sudo.
its Ubunutu11.04.
looking for your kind response.
|
|
|
|
05-05-2012, 01:08 PM
|
#10
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,802
|
you do not need root account if ssh installed.
you only need to configure the user you want to use.
|
|
|
|
05-05-2012, 01:11 PM
|
#11
|
|
Moderator
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 12,190
|
If you can use sudo you have root access will give you a root shell. Why can't you make changes to the server? If it is company policy ask your IT department why you have to use a service that is deprecated for years and known to be totally insecure and if they can install and configure SSH, since you don't want to use services that may make it possible to break into the company's systems.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:26 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|