ssh environment variable
When you run a command as an argument to ssh, the command is run directly by sshd; the shell is not involved. You can verify this using something like the following: ssh b@B pstree It is the shell (bash in this case) that pulls in your .bash_profile, and it only does so if the shell is invoked as a login shell, or if the shell was invoked with the --login option (see the bash man page; look for INVOCATION). The environment you get when running a command directly is set by things like sshd and PAM when you log in. Thus, if you want your .bash_profile, you need to run it under the shell and you need to run the shell as an interactive or login shell, like this: ssh b@B "bash -l -c 'env'" That should get you output you desire. The only thing to watch out for is that quoting gets tricky pretty quickly. Note that on Linux, at least, ssh b@B bash -l -c 'env' will not get you a login shell (I'm not sure why). |
http://serverfault.com/questions/586382/environment-variables-are-unavailable-when-running-scripts-over-ssh
ssh environment variable的更多相关文章
- Jenkins启动Tomcat时提示Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Jenkins构建提示: [SSH] executing...Neither the JAVA_HOME nor the JRE_HOME environment variable is defi ...
- TOMCAT-报错The BASEDIR environment variable is not defined correctly
<span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...
- myeclipse使用maven插件进行maven install时报错check $m2_home environment variable and mvn script match
check $m2_home environment variable and mvn script match 分类: maven2015-09-01 18:06 842人阅读 评论(0) 收藏 举 ...
- 教新手一步步解决:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to和更新gradle问题
android studio出现问题:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_O ...
- -Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
一, eclipse中使用maven插件的时候,运行run as maven build的时候报错 -Dmaven.multiModuleProjectDirectory system propery ...
- [转]Tomcat----Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
对于使用IDE开发的程序员来讲,并不是所有人都对自己用来吃饭的工具了如指掌.常在阴沟跑,哪能不翻船.为此我把自己使用Tomcat/Eclipse的一些经验教训整理了一下,会陆续的贴出来,也许会帮到和我 ...
- TOMCAT启动时报错:the CATALINA_HOME environment variable is not defined correctly
运行tomcat/bin目录下的startup.bat时报错:the CATALINA_HOME environment variable is not defined correctly 碰到这个问 ...
- Docker 容器中“TERM environment variable not set.”问题解决
在查容器内部资源利用情况时候,发现top命令无法使用,报错“TERM environment variable not set.”.从网上找到了解决方案,如下. [root@localhost ~]# ...
- JRE_HOME environment variable is not defined correctly This environment variableis needed to run this program
已经安装了JDK1.7 和对应JRE 安装了tomcat8 都是解压版 并设置了JAVA_HOME.JRE_HOME 但Tomcat在启动过程中找不到 错误: the JRE_HOME environ ...
随机推荐
- hadoop,yarn和vcpu资源配置
Hadoop YARN同时支持内存和CPU两种资源的调度(默认只支持内存,如果想进一步调度CPU,需要自己进行一些配置),本文将介绍YARN是如何对这些资源进行调度和隔离的. 在YARN中,资源管理 ...
- c语言对齐问题
引言 考虑下面的结构体定义: typedef struct{ char c1; short s; char c2; int i; }T_FOO; 假设这个结构体的成员在内存中是紧凑排列的,且c1的起始 ...
- SpringMVC一路总结(一)(转)
itRed You are never too old to set another goal or to dream a new dream. SpringMVC一路总结(一) SpringMVC听 ...
- percentiles of live data capture
For example, every ten seconds I got a server response time, I want to know the 90 percentile respon ...
- Jquery实现双击表单元格可编辑
<script type="text/javascript"> function doTableTdEditClick(param){ doTdEditable(par ...
- HDU 5839 Special Tetrahedron
HDU 5839 Special Tetrahedron 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n ...
- ionic 进入多级目录以后隐藏底部导航栏(tabs)(完美解决方案)
公司开始使用ionic开发项目,在此记录下把遇到的问题,网上有大牛已经把解决方法整出来了,不过记录在自己这里方便查阅. 这篇记录在有tabs的项目里,进入子层级时,底部导航还一直存在,本人是要让他只在 ...
- maven添加本地依赖包方法
1.某些情况下不方便上传本地依赖包到Maven repository,可以通过下面方法添加本地依赖包. 2.方法 1).pom.xml中添加以下代码块 <dependency> <g ...
- 网络最大流最短增广路Dinic算法模板
#include<cstdio> #include<cstring> #include<string> #include<cmath> #include ...
- Linux的cron和crontab
一 cron crond位于/etc/rc.d/init.d/crond 或 /etc/init.d 或 /etc/rc.d /rc5.d/S90crond,最总引用/var/lock/subsys/ ...