?
Solved

JSP code requires root privileges

Posted on 2007-03-29
5
Medium Priority
?
483 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

770 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