Unix/Linux Go Back    

Programming Post questions about C, C++, Java, SQL, and other programming languages here.

rlogin/rsh incoming port


Thread Tools Search this Thread Display Modes
Old Unix and Linux 08-17-2004   -   Original Discussion by andryk
andryk's Unix or Linux Image
andryk andryk is offline Forum Advisor  
Registered User
Join Date: Sep 2003
Last Activity: 5 June 2008, 4:15 AM EDT
Posts: 448
Thanks: 0
Thanked 1 Time in 1 Post
rlogin/rsh incoming port

Hi all,

In need to know why my sample code below that connect to a rlogind (513) fails, but original unix rlogin does not ? (.rhosts is verified to be correct)

I heard rlogin/rsh bind to a reserved port before connecting to the rlogin server. what are they ???

   s = socket(AF_INET, SOCK_STREAM, 0);
   sck.sin_family      = AF_INET;
   sck.sin_port        = htons(513);
   sck.sin_addr.s_addr = inet_addr("");

   if (connect(s, (struct sockaddr *)&sck,sizeof(sck)) <0) {
      printf("connect() error\n"); return;
   printf("Connected %d\n",s);


Any help would be appreciated Linux
Sponsored Links
Old Unix and Linux 08-17-2004   -   Original Discussion by andryk
Perderabo's Unix or Linux Image
Perderabo Perderabo is offline Forum Advisor  
Unix Daemon (Administrator Emeritus)
Join Date: Aug 2001
Last Activity: 26 February 2016, 12:31 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 471 Times in 271 Posts
rlogin is suid to root. So it can rcmd() and the associated routines on the rcmd man page. That includes rresvport(). See those man pages. User program can use rexec() which also has a man page.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to allow incoming UDP packets with iptables crimputt Linux 1 04-22-2012 12:18 AM
incoming mails not coming harishindn Linux 4 08-08-2010 03:54 PM
handling incoming messages charlitos IP Networking 1 04-14-2009 05:19 PM
run a script from incoming email jojo77 UNIX for Dummies Questions & Answers 7 02-22-2008 01:48 PM
Listening on port for incoming data? frustrated1 Shell Programming and Scripting 6 01-16-2004 06:48 PM

All times are GMT -4. The time now is 03:04 PM.