I have set of some (third-party) shell scripts, which are supposed to connect to remote host and start some daemons (hadoop, if that matters). These scripts rely heavily on hostname in order to configure pid folders, data directories etc.What I need to do now is to create some test/development environment on single machine, using Arch, which means:configure /etc/hosts to provide some aliases to 127.0.0.1, like data1, data2, data3 (that's the trivial part)configure passwordless SSH access to localhost (which is also trivial)somehow set the hostname for current SSH session, like if I connect using 'ssh data1' - then hostname should be data1 - and this is what I can't figure out.so I need to solve 2 problems:how do I pass some environment variable or something like that to remote host, so it will be visible to all scripts therehow do I set hostname on remote host for that session onlyand all this happens on the same computer.
Setting hostname variable right after SSH login
ssh;environment variables
While you can't change the hostname for a single process (well, it might be possible with namespaces), you can change the HOSTNAME environment variable.As for forwarding environmnet variables from client to server, see the AcceptEnv and PermitUserEnvironment optins for sshd and SendEnv for ssh (see man pages sshd_config(5) and ssh_config(5) for details).