UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » Java
  • » ServerSocket: Permision Denied

#1 2003-12-18 12:14 PM

ksenos
Member
Registered: 2003-12-18
Posts: 2

Re: ServerSocket: Permision Denied

Hello to all.

I am using java to create a simple network application and recently switched to linux from windows. The development started when I was still on windows. While trying to execute my app on linux I get the Permision Denied exception. Well I suppose this is normal because I am running it as a simple user. When running as root it works fine.

What I wanted to ask is what do to do in order to allow a simple user to create ServerSockets. I think the reason I need this is obvious. Opening a new console, logging in as root and execute the program is relatively  time consuming while I could click on the Run button on eclipse (are there any other nice and powerfull IDE's like eclipse?).

Thanks in advance  :D

Kostas

Offline

#2 2003-12-18 03:18 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: ServerSocket: Permision Denied

I don't know anything about Java, but I assume your problem is
that you're trying to bind() to a port less than 1024...  In all Unix
like systems, ports less than 1024 are reserved, and only root
is allowed to bind() to them...  There's not much you can really
do to get around this restriction (short of changing the kernel code,
anyway)...  Typically, servers that only need root privs for just
that simple act of bind()'ing immediately drop their privs as soon
as they've finished the bind(), and run the rest of their code
unpriviledged...  I'm not sure of the appriate Java method of
doing such a thing, if it's even possible... *shrug*

Offline

#3 2003-12-18 08:55 PM

ksenos
Member
Registered: 2003-12-18
Posts: 2

Re: ServerSocket: Permision Denied

That's it indeed.  :D

Thanks a lot.  :)

Offline

  • Index
  • » Java
  • » ServerSocket: Permision Denied

Board footer

Powered by FluxBB