Solved

JSP code requires root privileges

Posted on 2007-03-29
5
478 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 200 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 150 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 150 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

735 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