1
vote
1answer
16 views

Why does 'export foo=1' not get read when I use ssh?

I'm trying to set a remote environment variable explicitly in an ssh command: ssh worker-2 "export OPENBLAS_NUM_THREADS=1; echo $OPENBLAS_NUM_THREADS" Strangely, this prints just a blank line, but ...
0
votes
0answers
26 views

What environment variables are set when I use ssh?

When I use ssh, I notice that my TERM variable is forwarded automatically. This is quite useful, but I'm wondering what other variables are forwarded or set. So far I've found the following ...
0
votes
1answer
93 views

Modify persistent variables on a remote server host using 'ssh' from client host

As the title says, I want to modify environment variables on a remote server using 'ssh'. My first attempt was: $ ssh mysvr -l sikaiwei "getId=$ORANGE; echo $ORANGE; ORANGE=$((ORANGE+1)); echo ...
2
votes
1answer
66 views

Export bash function over SSH

I would like to export a bash function over ssh to use it in GNU parallel. That question seems to be answered here Exporting bash functions through ssh but I don't seem to be able to get it to work. ...
0
votes
1answer
21 views

Get the user name or host name of a connecting ssh user

I would like to get the user name or host name of a connecting ssh user to exec some functions in the .bashrc. # pseudo code if (ssh && connecting_ssh_username == "foobar") { do something ...
0
votes
3answers
835 views

How to keep variable preserve while running script through ssh

I am trying to run while loop with read through ssh: #!/bin/bash ssh root@10.10.10.10 "cat /var/log/syncer/rm_filesystem.log | while read path; do stat -c \"%Y %n\" "$path" >> ...
8
votes
4answers
2k views

Finding IP or hostname of origin machine (ssh)

I connect to a number of machines constantly, from different physical locations (and thus different physical machines). Most of this is done though ssh, sometimes a gateway machine or two is required ...
0
votes
1answer
107 views

Environmental variables in login shells and interactive shells

I'm sort of confused of login shells and interactive shells. If I run ssh my_remote_server 'echo $HOME' I can get /home/shawk But when I run ssh my_remote_server 'echo $ANOTHER_VAR' I got a ...
1
vote
1answer
278 views

Exporting bash functions through ssh

So I found a way to transfer environment variables through ssh without having to change neither server nor client: Transferring environment variable through SSH / quoting in bash/sh/csh/tcsh But I ...
4
votes
1answer
216 views

How can I obtain a 'desktop' cmd.exe subshell environment when SSH'ed into cygwin?

I've successfully configured SSH under cygwin, so I can SSH into my windows user account and land at a bash shell in cygwin. This is great. However, I have a python program that I'd like to run in ...
2
votes
2answers
135 views

Unable to get profile variable using ssh

Unable to retrieve the profile variable using ssh. server2 ==> user apptst ==> bash profile has $APPHOME variable. Was trying to retrieve the value from server1 using ssh but failed. Used options ...
4
votes
1answer
785 views

Escaping Variable in Cat

I'm trying to write a shell script over ssh via a bash prompt. The shell, however, insists on interpreting any variable I want to write instead of writing it directly to file. For example, cat ...
1
vote
3answers
2k views

Term Enviroment Variable not set, when executing a Bash File via SSH

i am trying to run a bash script on a remote machine. If I open a ssh connection in a terminal, i can easily run the script. But when i run it like that: ssh user@ip < /etc/script I get an ...
3
votes
2answers
1k views

Transferring environment variable through SSH / quoting in bash/sh/csh/tcsh

I want to transfer an environment variable over SSH. The "correct" way is using SendEnv/~/.ssh/environment, but that requires the server to support AcceptEnv or PermitUserEnvironment, which it does ...
0
votes
1answer
40 views

How can you use the domain of the client connected over ssh in the shell?

Is it possible to get the users ip address, domain name, or host-name of an established ssh connection in the shell? For example, when I connect over ssh the first printed line says something like ...
1
vote
2answers
976 views

Set environment variables for non-interactive ssh

Where is the most appropriate place to set environment variables for all (including non-interactive) ssh sessions, and for all users (including root)? I believe that it may be in a script under ...
10
votes
1answer
7k views

How can I set environment variables for a remote rsync process?

When I use rsync to copy files from one computer to another, an rsync process is started on both ends. However, on the remote end, shell initialization files are apparently not read, so I cannot set ...
3
votes
3answers
1k views

Use ~.ssh/config to always set TERM=cygwin for certain hosts?

I use WinSSHd on several Windows servers. To access them from my Mac (and presumably, just about any Unix-based terminal), I need to set the TERM environment variable to cygwin, e.g.: TERM=cygwin ssh ...