LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2005, 06:56 AM   #1
Streagan2
LQ Newbie
 
Registered: Nov 2004
Location: Surrey, UK
Distribution: Linux Mint 17
Posts: 14

Rep: Reputation: 0
Using JAAS's UnixLoginModule to login as root


I am running an app on a Linux box where I am already logged in. In Java I want to spawn a process that needs to run as root. I have tried to use JAAS's UnixLoginModule to login as root :
Code:
        Subject subject = new Subject();
        subject.getPrincipals().add(new UnixPrincipal("root"));
        LoginContext loginContext = new LoginContext("Login", subject, new MyHandler());
        loginContext.login();
but my callback handler that would supply the password is never called and I don't appear to be logged in as root. It looks like UnixLoginModule simply returns data about the current user which is a fat lot of good. Does anyone know what I can do to make this thing do what it is supposed to do and allow me to perform a login? If JAAS is inadequate is there another way to acheive this? Essentially I want to be able to login programatically.

Regards,

--------------------

Matthew

Surrey, England
My env: j2sdk1.4.2_06 running on Linux 2.6.11-1.27_FC3 running on Intel Pentium 4E Prescott 3.0GHz FSB800 1MB Cache on a ASUS P4S800 SiS648FX Socket 478 800FSB 3DDR 400 ATA133 motherboard
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to login as user; can login as root. rksanders Debian 24 02-09-2011 08:01 AM
wrong login shell prevent root login cefs99 Linux - Security 4 05-31-2006 08:28 AM
I have re-installed MK 9.2 but cannot login as user, login as root works. bobinglis Mandriva 2 02-22-2004 11:39 AM
can only login as root? user login doesnt work..? anyone? hacking_4_b33r Linux - General 1 02-05-2004 11:40 PM
root login incorrect ,then passwd root,but error sunnycn Linux - Security 6 05-20-2002 10:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration