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 ...
随机推荐
- 各种文件的ContentType
CONTENT_TYPE = { 16 '.load': 'text/html', 17 '.123': 'application/vnd.lotus-1-2-3', 18 '.3ds': 'imag ...
- Xcode好用的插件(随时更新)
古人云"工欲善其事必先利其器",打造一个强大的开发环境,是立即提升自身战斗力的绝佳途径!下面简单介绍下插件是什么.如何使用Xcode插件以及一些常用的Xcode插件的推荐. 一.插 ...
- QT自绘标题和边框
在QT中如果想要自绘标题和边框,一般步骤是: 1) 在创建窗口前设置Qt::FramelessWindowHint标志,设置该标志后会创建一个无标题.无边框的窗口. 2)在客户区域的顶部创建一个自绘标 ...
- Oracle获取时间日期月份星期数
1.日期和字符转换函数用法(to_date,to_char)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; ...
- ubuntu 16.04下搭建web服务器(MySQL+PHP+Apache) 教程
1.开始说明 下面很多可能参照网上其中以为前辈的,但有所改进吧.这些设置可能会有所不同,你需要根据不同情况进行修改. 安装apache2 2.切换管理员身份 在ubuntu中需要用root身份进行操作 ...
- PHP中date函数月和日带0问题
一.带零 echo date('Y-m-d'); 2012-08-08 二.不带零 echo date('Y-n-j'); 2012-8-8 以下为参数详解(转载): a - "am&q ...
- openstack私有云布署实践【14.1 登录页dashboard-controller(科兴环境)】
2台kxcontroller安装组件 # yum install openstack-dashboard -y 修改一样的配置 vi /etc/openstack-dashboard/local_ ...
- CodeForces 705A Hulk
水题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...
- Cookie的简单使用
一,新建一个空网站,添加一个Default.aspx <%@ Page Language="C#" AutoEventWireup="true" Code ...
- hdu_2328_Corporate Identity(暴力枚举子串+KMP)
题目链接:hdu_2328_Corporate Identity 题意: 给你n个串,让你找这n个串的最大公共子串 题解: 串比较小,暴力枚举第一个的子串,然后KMP判断是否可行 #include&l ...