raw socket creation prob ..

raw socket creation prob ..

Post by Uda » Tue, 01 Jan 2002 17:15:06



i m new to socket programming.
started with developing a minimalistic ping.
but i m uanble to ping if i m logged in as an normal user (non - root)
it works fine, if logged in as root or root previledges.
I looked for the "raw" manpage, where it said, the creation of raw
socket requires root pervileges.
As far as i know, most ping utils use raw sockets (opposed to udp).
how do i overcome this prob, so even non-suid users can use my ping?
any ideas are welcome.
also any good "raw network programming" resources?
wish u all a socket new year,
 Uday
 
 
 

raw socket creation prob ..

Post by Gianni Marian » Tue, 01 Jan 2002 17:34:42


How about using the same mechanism as the regular ping ?

   24 -rwsr-xr-x    1 root     root        22620 Jan 16  2001 /bin/ping*

Note that ping on my system is suid root !

Or :

su root
chown root myping
chmod u+s myping
exit
./myping 127.0.0.1

G


> i m new to socket programming.
> started with developing a minimalistic ping.
> but i m uanble to ping if i m logged in as an normal user (non - root)
> it works fine, if logged in as root or root previledges.
> I looked for the "raw" manpage, where it said, the creation of raw
> socket requires root pervileges.
> As far as i know, most ping utils use raw sockets (opposed to udp).
> how do i overcome this prob, so even non-suid users can use my ping?
> any ideas are welcome.
> also any good "raw network programming" resources?
> wish u all a socket new year,
>  Uday


 
 
 

raw socket creation prob ..

Post by Uda » Tue, 08 Jan 2002 20:42:22


It worked!!
 It did allow any user to ping (and open a raw socket).
but some difficulties ..

Quote:> su root
> chown root myping
> chmod u+s myping

 Whatz goin on here? +s what does it mean?? plz do explain,
(sorry, if its too basic , but i did'nt find anything related to that
opt (+s) in the man pages.)
do let me know how it worked..
 (mailer daemon on ur mail ID)
 Uday
 
 
 

raw socket creation prob ..

Post by Carl » Thu, 10 Jan 2002 19:54:35



> It worked!!
>  It did allow any user to ping (and open a raw socket).
> but some difficulties ..

> > su root
> > chown root myping
> > chmod u+s myping

>  Whatz goin on here? +s what does it mean?? plz do explain,
> (sorry, if its too basic , but i did'nt find anything related to that
> opt (+s) in the man pages.)

 yes man it's just there:
man chmod ->
 "The letters `rwxXstugo' select the new permissions for the
       affected users: read (r), write (w),  execute  (or  access
       for directories) (x), execute only if the file is a direc-
       tory or already has execute permission for some user  (X),
   --->set  user  or group ID on execution (s), save program text
       on swap device (t)... "

it means that when somebody executes the program 'myping' the
execution has the same permission of the owner, in this case root. if
you check for example the passwd program, it has the same permission
value becuase he is the only with write privileges in /etc/passwd text
file. You got me?
Hope I helped you

PS. can you send me that program you did? it has to be interesting...