Java Beginners

Moderators: zibadian
Number of threads: 1285
Number of posts: 2739

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to get root access Posted by Vilanye on 15 Feb 2008 at 10:51 AM
I am writing a program that uses a library that needs root access in linux and administator rights in Windows. How do I gain access in code?
Just my 2 bits
Report
Re: How to get root access Posted by zibadian on 15 Feb 2008 at 12:47 PM
: I am writing a program that uses a library that needs root access in
: linux and administator rights in Windows. How do I gain access in
: code?
: Just my 2 bits

AFAIK you cannot, not even with native programs. If the logged in user has admin/root rights, then each program which he starts has those rights.
Report
Re: How to get root access Posted by moo on 16 Feb 2008 at 3:06 PM
: I am writing a program that uses a library that needs root access in
: linux and administator rights in Windows. How do I gain access in
: code?
: Just my 2 bits
under linux you can write a shell script that starts your java program as root (have a look at suid root). maybe you should try to get around this. and what are you doing so that you need admin right under windows? This sounds a little strange to me...
Report
Re: How to get root access Posted by Vilanye on 20 Feb 2008 at 4:22 PM
: : I am writing a program that uses a library that needs root access in
: : linux and administator rights in Windows. How do I gain access in
: : code?
: : Just my 2 bits
: under linux you can write a shell script that starts your java
: program as root (have a look at suid root). maybe you should try to
: get around this. and what are you doing so that you need admin right
: under windows? This sounds a little strange to me...

I am capturing packets using the Jpcap library(not jpcap) and it requires root access in *nix and admin in Windows. The program I am writing does not always use this library so doesn't need root. I was just hoping I could drop root privileges when it is not needed.


Just my 2 bits
Report
Re: How to get root access Posted by zibadian on 21 Feb 2008 at 12:08 AM
: : : I am writing a program that uses a library that needs root access in
: : : linux and administator rights in Windows. How do I gain access in
: : : code?
: : : Just my 2 bits
: : under linux you can write a shell script that starts your java
: : program as root (have a look at suid root). maybe you should try to
: : get around this. and what are you doing so that you need admin right
: : under windows? This sounds a little strange to me...
:
: I am capturing packets using the Jpcap library(not jpcap) and it
: requires root access in *nix and admin in Windows. The program I am
: writing does not always use this library so doesn't need root. I was
: just hoping I could drop root privileges when it is not needed.
:
:
: Just my 2 bits

From a security standpoint it should be impossible for a program to arbitrarily turn root access on or off. Image visiting a website, which installs an activeX control/applet on your computer, then turns on root access for itself and implant a backdoor, virus, or other malware.
A workaround for your program would be to inform the user that capturing packets is not possible, when he has less than root access. You could also disable the controls, which activate the capturing when you don't have root access.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.