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 ...
随机推荐
- JS 一些常用技巧
记录 JS 常用的技巧 1. 生成随机数 2. 解决浮点数问题 3. 无路可走时,看看是不是 事件 冒泡了...
- Form提交时隐藏Token验证
前端声称一个Token @Html.AntiForgeryToken() 后台对Token进行验证 AntiForgery.Validate();
- [Jmeter]jmeter之脚本录制与回放,优化(windows下的jmeter)
一.录制脚本: 1.启动jmeter 2.添加线程组 3.添加http代理 4.配置代理 a.jmeter侧(注意:lest plan content这里需要选择目标控制器,本文即测试计划中需要选择的 ...
- Scala 类和对象
Scala class: Scala 源文件中可以有很多类(class),这些类默认都是Public的,public是Scala的默认访问级别.在Scala中,声明一个未用priavate修饰的字段 ...
- java调用wsdl xfire和cxf两种方式
xfire 如下: String spID = ""; String password = ""; String accessCode = "&quo ...
- Java JDBC Batch
Java批量处理数据 import java.sql.Connection; import java.sql.PreparedStatement; //import String sql = &quo ...
- xshell 注册码
Xshell 5 注册码: 101210-450789-147200Xftp 5 注册码:101210-450789-147200 Xmanager 5 注册码:101210-450789-14720 ...
- LWP::UserAgent介绍3 -> cookie设置
use LWP::UserAgent; use HTTP::Cookies; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Coo ...
- Mac软件记录
前端: Brackets,sourceTree,dreamweaver,ps,ai,softmatic Weblayers. phpStorm,pyCharm,IDEA,eaclipse,XCODE, ...
- RabbitMQ队列
AMQP ,即Advanced Message Queuing Protocol,高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计.消息中间件主要用于组件之间的解耦,消息的发送者无 ...