?
Solved

JSP code requires root privileges

Posted on 2007-03-29
5
Medium Priority
?
489 Views
Last Modified: 2013-11-15
Tomcat5, Ubuntu 6.06, Java5
I have written a class which accesses the Parallel Port on my PC - I am using parport: http://www.geocities.com/Juanga69/parport/
 
I have so far been running this class as root and it all works fine.

Now I want to use this class in a JSP - this means the user will no longer be root, it will be tomcat.

Any idea how to get around this?
0
Comment
Question by:basicinstinct
5 Comments
 
LVL 23

Author Comment

by:basicinstinct
ID: 18821083
By the way, the parallel port access requires the user to have root privileges
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 600 total points
ID: 18821110
then your tomcat has to run under root privilage. i.e. the process needs to be started using root privilages.
0
 
LVL 24

Assisted Solution

by:sciuriware
sciuriware earned 450 total points
ID: 18821679
And if you are NOT running as root and change the owner of the parallel port to yours?

;JOOP!
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 450 total points
ID: 18825863
>> the parallel port access requires the user to have root privileges

Why? If you have a printer connected to the parallel port, can any other user not print documents on it?

Anyway if you are running Tomcat as a service or daemon in Ubuntu, you can try to change its user-name to root as Kuldeep suggests
0
 
LVL 23

Author Comment

by:basicinstinct
ID: 18826981
Hi, thanks for the suggestions.  I played around tring to add the tomcat user to the 'root' group but it didn't make much difference.  Maybe I am doing something wrong.  Anyway I'm thinking there may be some security issues running tomcat as root.

Anywho, as this application is a hobby project and nothing professional I have gone for a workaround.  The parallel port program now listens for commands on a java.net.ServerSocket.  I wrote a client class which knows how to send commands to the parallel port program over tcp/ip. The JSP uses this client class.

The parallel port program is running as root, the JSP is running as tomcat and it all works nicely.  

0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question