Solved

JSP code requires root privileges

Posted on 2007-03-29
5
472 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:mayankeagle
mayankeagle 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now