Find the answer to your Linux question:
Results 1 to 6 of 6
Hey everybody, I have just a one line script that runs telnet, and even though I've looked around I thought maybe someone could just tell me if there is a ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    44

    Telnet and automatic login

    Hey everybody,

    I have just a one line script that runs telnet, and even though I've looked around I thought maybe someone could just tell me if there is a way to automatically login to the telnet server without having to type it in everytime. It's more of a hassle type of thing, but no matter what I've tried, I can't get anything to work. Any suggestions?

    G.

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    the short answer is a scripting language called expect. the long answer is why would you ever want to use telnet and not SSH?

    With ssh you can use public / private keypair to have authentication without password prompts. That and the fact that it is not sending password in clear text make it a MUCH better option.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  3. #3
    Just Joined!
    Join Date
    Oct 2008
    Posts
    44

    Hmmm...

    I've heard of (and likely used) SSH since I installed Linux, but I don't know how to integrate it with Telnet through a standard TTY with a shell running. Any comments?

    G.

  4. #4
    Just Joined!
    Join Date
    Oct 2008
    Posts
    44

    Still not quite sure

    Well, I fooled around with it some, but I can't figure out how to get the user/pass combo to log in. Something like "ssh uname@machine.com telnet remote.com" but that doesn't seem to do it. Can anybody give an example or something to point me in the right direction?

  5. #5
    Just Joined!
    Join Date
    Mar 2009
    Location
    Norway
    Posts
    52
    Hi,

    create a keypair:
    Code:
    ssh-keygen -t rsa -b 2048
    answer yes to all questions (default is perfectly fine)

    copy the file $HOME/.ssh/id_rsa.pub to your target machine, it must be *appended* in $HOME/.ssh/authorized_keys2 on the target.

    Then, log in via ssh
    Code:
    ssh username@server.example.org
    Don't bother adding telnet to an ssh-command, they are *not* the same commands. And ssh will use a tty, so you should not have to change all that much in your script.

  6. #6
    Just Joined!
    Join Date
    Oct 2008
    Posts
    44

    Allright!

    Quote Originally Posted by henrikau View Post
    Hi,

    create a keypair:
    Code:
    ssh-keygen -t rsa -b 2048
    answer yes to all questions (default is perfectly fine)

    copy the file $HOME/.ssh/id_rsa.pub to your target machine, it must be *appended* in $HOME/.ssh/authorized_keys2 on the target.

    Then, log in via ssh
    Code:
    ssh username@server.example.org
    Don't bother adding telnet to an ssh-command, they are *not* the same commands. And ssh will use a tty, so you should not have to change all that much in your script.
    I'll sure give it a try. I always knew SSH was there, I just never knew you could use it like this.

    Thanks, I think!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...