Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6792305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:57:10+00:00 2026-05-26T17:57:10+00:00

I try to start some command from ssh non-interactive ssh connection. I use ant-sshexec

  • 0

I try to start some command from ssh non-interactive ssh connection. I use ant-sshexec connection for that.

In order to set everything up I used this article:
http://www.raphink.info/2008/09/forcing-environment-in-ssh.html

I use ~/.ssh/environment.
In order to do that, I set PermitUserEnvironment to “yes” in sshd_config and restarted sshd.

In my .ssh/environment I have this content:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/ubuntu/java/jdk1.6.0_27/bin

JAVA_HOME=/home/ubuntu/java/jdk1.6.0_27

#PATH=/home/ubuntu/java/jdk1.6.0_27/bin:$PATH

#PLAY_HOME=/home/ubuntu/play

and I have the error when try to connect using non-interactive connection:

 [sshexec] Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). 

But I added the java to the path..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:57:11+00:00Added an answer on May 26, 2026 at 5:57 pm

    The man page for sshd(8) says this about ~/.ssh/environment:

        It can only contain empty lines, comment lines (that start with
        ‘#’), and assignment lines of the form name=value.
    

    That is, it is not a shell script at all. You have double quotes, variable expansion and an alias definition. None of that will work. Try this:

    PATH=/home/ubuntu/java/jdk1.6.0_27/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    JAVA_HOME=/home/ubuntu/java/jdk1.6.0_27
    PLAY_HOME=/home/ubuntu/play
    

    Also ensure that the permissions on the ~/.ssh/environment are as described in the man page — no group or other write permissions on the file.

    If you are concerned with locking yourself out of the account with a broken environment, test by logging onto the host first and running test commands such like this:

    ssh localhost 'echo $JAVA_HOME'
    

    You can ensure that the environment variables are set as you expect them and if something goes wrong, you are still logged onto the host allowing you to reverse your changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now we just use something like this stopWatch.Start(); try { method(); } finally
I've some trouble with winAnt. Everytime I try to start the build process with
I have a command line executable that is run from a C# class library.
I'm working on something that requires me to start to subprocess(command prompt) and execute
i try to run php processes in background and start this from an php
I have some unit tests that use Azure Storage. When running these locally, I
Sometimes when I try to start Firefox it says a Firefox process is already
getting error while try to start service
When I try to start the Sql Server (SqlExpress) service I got the following
When I try to start Firefox using Process.Start and ProcessStartInfo (.NET) everything seems to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.