a401
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, Shell, Perl, Sed & Awk |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have configured init to keep alive ssh tunnels specifying some ssh commands in /etc/ttys. (For details see init(8).) It worked perfectly. Now I must use passphrase protected private keys for ssh. To be able to use the key without typing in the passphrase all the time (which is impossible for an automated ssh tunnel) I use the ssh-agent. Now my problem is that ssh communicates with ssh-agent through a socket stored in the SSH_AUTH_SOCK environment variable that is totally unknown by the init. How could I pass this variable to init? Specifying it in /etc/profile and /etc/csh.login does not work. Tried to create a script setting and exporting the variable and make init to run it with init_script loader variable does not work. The only way I could make it work was to specify something similar to Code:
sh -c 'SSH_AUTH_SOCK=/tmp/ssh-init/agent ssh user@host' Code:
ssh user@host This is problematic as it starts two processes instead of only one and init monitors the sh process instead of the ssh and can produce misleading error messages. Not the best... So the question is again: how could I pass some environment variables to init? Thanks! |
|
#2
|
||||
|
||||
|
You can make an sh script that sets env variable and then exec(1) your ssh
Or may write Code:
sh -c 'SSH_AUTH_SOCK=/tmp/ssh-init/agent exec ssh user@host' Last edited by Alt; July 9th, 2010 at 12:04. |
|
#3
|
|||
|
|||
|
Yes, thanks for this tip. This solves my problem with the processes.
But the question is still alive: can I set environment variables for init (or in more general for processes already running)? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Perl module variables | Alt | Userland Programming & Scripting | 4 | June 26th, 2010 09:52 |
| Environment of daemon when starting with sudo | ractive | Porting New Software | 3 | January 27th, 2010 14:54 |
| Programming environment in FreeBSD | probe | Userland Programming & Scripting | 14 | September 23rd, 2009 12:59 |
| init scripte with nfs | genius0815 | Userland Programming & Scripting | 2 | July 27th, 2009 12:44 |
| HOWTO: install Visual Understanding Environment (VUE) | rocky | Howtos & FAQs (Moderated) | 0 | April 3rd, 2009 04:23 |