Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command not found via ssh with single command, found after connecting to terminal [duplicate]

Tags:

Possible Duplicate:
Why does an SSH remote command get fewer environment variables then when run manually?

If I put command

ssh user@$IP ant

then I receive

bash: ant: command not found

but when I log into

ssh user@$IP

and put

ant

then work fine.

Ant is installed on remote and local machines. Where is the problem?

I've tried to find solution in google and found nothing.

Thanks in advance for help!

--EDIT--

I need to invoke some bash scripts, don't want to change all paths to full path.

like image 463
Marek Bardoński Avatar asked May 12 '12 10:05

Marek Bardoński


People also ask

Why I am getting command not found?

There could be three possible reasons why it cannot find the command: It's a typo and the command name is misspelled. The command is not even installed. The command is basically an executable script and its location is not known.

Why Linux is showing command not found?

When you're trying to run a command (with or without sudo ) and get an error message that reads "Command not found," this means the script or file you're trying to execute doesn't exist in the location specified by your PATH variable.


1 Answers

By default profiles aren't loaded when connecting via ssh. To enable this behaviour, set the following option in /etc/ssh/sshd_config:

PermitUserEnvironment yes 

afterward restart ssh

/etc/init.d/ssh restart 
like image 52
Chris Montanaro Avatar answered Sep 21 '22 09:09

Chris Montanaro