LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 04:38 AM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 546

Rep: Reputation: 37
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, 04:45 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Why are you not using SSH instead?
 
1 members found this post helpful.
Old 12-04-2014, 04: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: 344Reputation: 344Reputation: 344Reputation: 344
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, 06:59 AM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
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, 07:34 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

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

Original Poster
Rep: Reputation: 37
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



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 04:24 AM
command line download accelerator with username and password support? steve51184 Linux - Server 4 07-18-2008 11:03 AM
Include scp password in command cli_man Linux - General 1 08-05-2005 03:47 PM
How to include password with su-command? Ollir Mandriva 2 08-16-2004 05:17 AM
Telnet not asking for username / password AlexHeylin Linux - Security 4 09-22-2003 02:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:42 PM.

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
Open Source Consulting | Domain Registration