LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2014, 05:38 AM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 383

Rep: Reputation: 24
telnet command to include username and password


I'm been searching on google but I can't find a telnet command example that incorporates the username and password all in one command. I know how to telnet in to another machine but it always stops and asks me for the password which i then type in.
I figured there must be a way to include the username and password in the telnet command so it logs me in in one go but I haven't found any example. Can this be done?
 
Old 12-04-2014, 05:45 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
Why are you not using SSH instead?
 
1 members found this post helpful.
Old 12-04-2014, 05:47 AM   #3
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by tonj View Post
I'm been searching on google but I can't find a telnet command example that incorporates the username and password all in one command. I know how to telnet in to another machine but it always stops and asks me for the password which i then type in.
I figured there must be a way to include the username and password in the telnet command so it logs me in in one go but I haven't found any example. Can this be done?
not with something as simple as telnet. That's because telnet is designed to be "dumb" and totally protocol ignorant - telnet just establishes a connection, but nothing else. A login with username and password, however, is protocol specific, and therefore beyond the scope of telnet.

I guess you want to log in to a remote shell like bash or something? Maybe ssh is an alternative, especially as telnet would transmit all data (including a password) unencrypted and thus unprotected, while ssh establishes an SSL connection. That's why the use of telnet is often discouraged.

[X] Doc CPU
 
Old 12-04-2014, 07:59 AM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by Doc CPU View Post
That's because telnet is designed to be "dumb" and totally protocol ignorant - telnet just establishes a connection, but nothing else. A login with username and password, however, is protocol specific, and therefore beyond the scope of telnet.
A telnet client used to connect to a non-telnet port is just transport but when used to the telnet server port (23) it does protocol stuff.
 
Old 12-04-2014, 08:34 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
you need to use expect to be able to automatically login in a telnet session
 
Old 12-04-2014, 11:18 AM   #6
tonj
Member
 
Registered: Sep 2008
Posts: 383

Original Poster
Rep: Reputation: 24
thankyou for the response here, I ended up using ssh. Here's what worked:
Code:
# yum install sshpass
then
Code:
sshpass -p <password> ssh user@<machine-ip-address>
this worked and I was able to login to another server all in one command. I had to log in once with ssh manually just to (kind of) set it going and after that it worked ok.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh with username and password in the command itselt jit2d Programming 8 02-08-2012 05:24 AM
command line download accelerator with username and password support? steve51184 Linux - Server 4 07-18-2008 12:03 PM
Include scp password in command cli_man Linux - General 1 08-05-2005 04:47 PM
How to include password with su-command? Ollir Mandriva 2 08-16-2004 06:17 AM
Telnet not asking for username / password AlexHeylin Linux - Security 4 09-22-2003 03:24 PM


All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration