Results 1 to 5 of 5

Thread: accepting root passwd from UI and passing it to a shell script to extract a rpm

  1. #1

    accepting root passwd from UI and passing it to a shell script to extract a rpm

    Hi

    Im working on Redhat Linux.
    Im a normal/domain user and Im writing an installation program which opens up a UI asking for root password and installs Java (jdk) using the
    j2sdkXXX.rpm package.

    If I run a shell script with the command

    su -c "rpm -i j2sdkXXX.rpm"

    how can I pass the super user password to the script from my UI ??.

    su seems to be taking the password only thru the console and not from other
    sources (variable,file etc)
    Can anybody help me ??!!

    (I also tried to use

    stty -F file.txt

    with file.txt containing password
    It dint work out)

    Awaiting solution ...


    Thanks in advance,
    rameshvl

  2. #2

    Re:accepting root passwd from UI and passing it to a shell script to extract a r

    Sounds interesting. What toolkit are you using for the UI and whats the language? That might help come up with a solution faster.

    I use perl/tk for my package installer but I require it to be run as root for them to use it. If they are not root it complains and tells the user why they can not run the application.

  3. #3

    Re:accepting root passwd from UI and passing it to a shell script to extract a r

    Hi Ashcrow,

    I tried using tcl/tk for UI in the beginning. I dint find it more user-friendly. So, later i decided to use java itself to have more control on my UI coz my single UI has many options for the user, and will install many packages based on user's requirement.
    So, i will use the extracted version of JRE in my installation CD to open up the UI written using Java Swing, which installs JDK, postgreSQL database etc using rpm files.
    I think my requirement cannot be fulfilled considering the fact that OS is controlling everything related to root password, for security reasons. But unfortunately, i need the solution coz my installation must be UI based, not a command-line based
    (This is my client's requirement, he is not even ready to login to the system as root and do the entire installation process)

    hope i get a solution,
    thanks anyway

    rameshvl

  4. #4

    Re:accepting root passwd from UI and passing it to a shell script to extract a r

    Just a thought, may not help:
    Can you set the uid for the program to root and then just give the users execute priveleges for it? I may not completely understand what your trying to accomplish but it seems to me like this may help.

    :P
    10Ded

  5. #5

    Re:accepting root passwd from UI and passing it to a shell script to extract a r

    Well the quick fix, and maybe the best in an installer program, is to just require it to be run as root. At the entry point in your code make sure that the uid and/or gid is 0 (or username is root). Here is the perl/tk code I used to accomplish this ...

    Code:
    # check for root like always! 
    # $< is UID and $) is GID
    #
    if (($> ne 0) && ($) ne 0)) { 
    ***print "You must be root or an authorized user! Bad user number $<!\n"; 
    
    ***$mw = MainWindow->new(-title => "Sorry");
    ***$l = $mw->Label(-text => "You must be root to run this program\nBad user number $<\n");
    ***$b = $mw->Button(-text => "exit",
    ********* -command => [\&exit_prog,"noask"]);
    ***$l->pack();
    ***$b->pack();
    ***
    ***MainLoop;
    }
    Your only other option would be to use PAM or get code from Red Hat/Mandrake that interfaces with PAM.

Similar Threads

  1. Shell script coding
    By lab in forum Programming
    Replies: 0
    Last Post: 07-05-2012, 01:49 PM
  2. Shell script for geoiplookup cmd
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 10-19-2010, 10:18 AM
  3. Need of shell script
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 09-16-2010, 02:34 PM
  4. Shell script for monitoring
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 09-16-2010, 05:54 AM
  5. Replies: 4
    Last Post: 07-08-2007, 07:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •