LinuxQuestions.org
Help answer threads with 0 replies.
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 09-24-2010, 06:18 AM   #1
kusanagiyang
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Rep: Reputation: 1
a telnet daemon without password


hello,

i am trying to write a telnet server without username/password function. does anyone know a tutorial on how to implement such function? the source code from inetutils seems complicated ... thanx
 
Old 09-24-2010, 05:48 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Have you looked at nc?
 
1 members found this post helpful.
Old 09-25-2010, 12:13 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
A telnet server can be as simple as a socket listening on an arbitrary port. Often, a telnet client is one of the tools used early in testing/debugging of a socket-based IP server application. In the 'usual' Linux telnet daemon, authentication is seconded to the 'login' program. See the telnetd manpage.
For a good primer on writing networking applications, see Beej's Guide to Network Programming
--- rod.
 
1 members found this post helpful.
Old 09-26-2010, 03:19 AM   #4
kusanagiyang
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 1
a shell

Quote:
Originally Posted by theNbomr View Post
A telnet server can be as simple as a socket listening on an arbitrary port. Often, a telnet client is one of the tools used early in testing/debugging of a socket-based IP server application. In the 'usual' Linux telnet daemon, authentication is seconded to the 'login' program. See the telnetd manpage.
For a good primer on writing networking applications, see Beej's Guide to Network Programming
--- rod.
thanks a lot. i was thinking about sending a string and call system() to execute it. libevent and select() is a must-have next step.
at meantime, i still need to learn how to program daemon to throw back a shell to client. for telnet, i guess this happens after login and authentication are done. i thought some simple io redirection should do it, but dont know how.
any pointer is appreciated
 
Old 09-26-2010, 03:29 AM   #5
kusanagiyang
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 1
how to get a shell in the client side

Quote:
Originally Posted by jefro View Post
Have you looked at nc?
i dont know nc very well (however, its functionality is well known...)
it doesnt seem to throw back a shell in client side, does it?
i want to learn how to program daemon to return a shell to a connected client.
 
Old 09-26-2010, 11:59 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Okay, now I'm confused. You say you don't want to use username + password entry, but you do still want authentication + login. Are you planning to launch your shell with the UID of the telnet daemon process?

Your daemon should be able to do something like fork() + exec() a shell, with the stdin and stdout file descriptors attached to the telnet server's socket. See Chapters 2 & 4 of Beej's Guide to Unix IPC for some explanation of how to do this. The daemon would then listen to the socket, and write all received data to the child shell's stdin pipe, and write to the socket anything read from the shell's stdout pipe.

--- rod.
 
1 members found this post helpful.
Old 10-01-2010, 05:39 PM   #7
beej71
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
There a network protocol behind telnet, as well

Be advised that a telnet client might send interesting stuff to your server that you might not be expecting, as per RFC-854 ("TELNET"). For example, you might see these bytes upon connecting:

255 253 1

which means "IAC DO ECHO", or the client is requesting that you echo everything back it sends. You don't have to echo; you can respond:

255 252 1

which is "IAC WONT ECHO", and the client has to deal.

There's probably stuff I'm forgetting, but I think the simplest thing you can do is if you get:

"IAC DO xxx"

respond:

"IAC WONT xxx"

and if you get:

"IAC WILL xxx"

respond:

"IAC DONT xxx"

and if you get:

"IAC IAC"

convert it into a single byte of value 255 and don't respond with anything in particular.

But in to handle telnet clients in general, you'll need to at least do some basic processing of the telnet protocol.

I *think*. It's been years since I messed with writing telnet clients.
 
Old 10-02-2010, 05:17 PM   #8
kusanagiyang
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 1
sorry about the confusion

Quote:
Originally Posted by theNbomr View Post
Okay, now I'm confused. You say you don't want to use username + password entry, but you do still want authentication + login.

sorry i didnt mean to confuse you. now i just want a remote shell; other functions may be implemented later, but not an issue now.

Are you planning to launch your shell with the UID of the telnet daemon process?

... i thought so. is this not good?

Your daemon should be able to do something like fork() + exec() a shell, with the stdin and stdout file descriptors attached to the telnet server's socket. See Chapters 2 & 4 of Beej's Guide to Unix IPC for some explanation of how to do this. The daemon would then listen to the socket, and write all received data to the child shell's stdin pipe, and write to the socket anything read from the shell's stdout pipe.

i am reading them now. interesting stuff. many thanks for the suggestion.

--- rod.
pls c above

Last edited by kusanagiyang; 10-02-2010 at 05:23 PM.
 
Old 10-02-2010, 05:22 PM   #9
kusanagiyang
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 1
cool

Quote:
Originally Posted by beej71 View Post
Be advised that a telnet client might send interesting stuff to your server that you might not be expecting, as per RFC-854 ("TELNET"). For example, you might see these bytes upon connecting:

255 253 1

which means "IAC DO ECHO", or the client is requesting that you echo everything back it sends. You don't have to echo; you can respond:

255 252 1

which is "IAC WONT ECHO", and the client has to deal.

There's probably stuff I'm forgetting, but I think the simplest thing you can do is if you get:

"IAC DO xxx"

respond:

"IAC WONT xxx"

and if you get:

"IAC WILL xxx"

respond:

"IAC DONT xxx"

and if you get:

"IAC IAC"

convert it into a single byte of value 255 and don't respond with anything in particular.

But in to handle telnet clients in general, you'll need to at least do some basic processing of the telnet protocol.

I *think*. It's been years since I messed with writing telnet clients.
cool stuff!
i am trying to connect to remote and open a remote shell though
 
  


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
enabling telnet daemon on RHEL 5.0 thanix Linux - Newbie 1 12-10-2008 02:55 AM
can't get Kerberos telnet daemon running on RHEL 3 nickgarnett Linux - Networking 0 11-21-2006 05:58 PM
password for lisa daemon... chanlo1706 Linux - Networking 1 06-20-2005 04:57 PM
Password through telnet Ephracis Programming 9 12-16-2004 05:21 PM
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 05:00 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration