Executing a shutdown of JBoss as a linux normal user that has sudo access.

Posted on 2009-04-17
Last Modified: 2013-12-16
Hi Experts,

I have a user student that I have granted sudo access on Linux so that he can execute the following command /jboss-4.0.4.GA/bin/ to shutdown JBoss. I get the following error appearing when i try with the student user:
student@server1 bin]$ sudo ./
/jboss-4.0.4.GA/bin/ line 78: exec: java: not found
Seems it cant find the Java VM for that user...
Has anyone ever tried to stop jboss  as a different user.

The Duke
Question by:LinuxDuke
    LVL 2

    Expert Comment

    that problem indicates no java for your user.
    in the linux box type set |grep JAVA_HOME


    java --version

    tell me wath you get
    LVL 6

    Expert Comment

    Find your java install folder, then do

    export JAVA_HOME=/opt/jdk1.5.0_16 (adjust to your java install path)
    export PATH=$PATH:$JAVA_HOME/bin

    Note: try to find your java path using ' find / -type f -name java'

    Author Comment

    Hi Experts,

    I logged as the user student and exported JAVA_HOME and PATH and this is the out put I get but this disappears when I log off where should I place this on a file where it will be permanent for this user.
    As I still get the same error when I execute the

    [student@server1~]$ set |grep JAVA_HOME
    [student@server1 ~]$

    [student@server1 bin]$ sudo ./ -S
    /jboss-4.0.4.GA/bin/ line 78: exec: java: not found
    LVL 6

    Accepted Solution

    edit .profile file in user home dir.
    LVL 20

    Expert Comment

    You also forgot to amend the path, so the shell cannot find the java executable. Please try all the steps above, and see what happens then.

    Easiest might be to put all this in a script and "sudo /path/to/script" from the user, just for ease of use, unless you want the environment change ... If you do set the users environment, remember to preseve that in the sudo call, via the -E flag ... would make the call look like "sudo -E /path/to/script". Might actually be all that is wrong here, that the user didn't try preserve the environment:/

    -- Glenn

    Author Comment

    I decided to give the user super user access via sudo to resolve this has he need to execute that commanda.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    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…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    758 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

    10 Experts available now in Live!

    Get 1:1 Help Now