ssh with an alternative configuration directory?

0

Is there any way to run the standard Cygwin ssh command with an alternative $HOME directory or an alternative .ssh configuration directory?

UPDATE: it turns out this is a duplicate question; but it hasn't been answered yet.

reinierpost

Posted 2013-10-14T18:33:18.457

Reputation: 1 904

Please explain some more. Why exactly do you need a separate $HOME for cronjobs? What kinds of cronjobs? What would that $HOME be? Can you just run the cron as a different user using /etc/crontab? Have you read man ssh? Won't the -F and/or -i options do? – terdon – 2013-10-14T18:39:35.403

I've deleted the sentence about the cron jobs. Sorry about that. Please just consider the problem as stated. BTW, a first glance at the source code in ssh.c doesn't leave much hope. – reinierpost – 2013-10-14T18:41:54.753

Could you also answer my other questions? If this is about cron there are probably better ways of doing it but why not use the -F and -i options? What exactly are you trying to do? – terdon – 2013-10-14T18:46:50.833

One question at a time. I was trying to avoid the real question because it takes about 4 paragraphs to explain and people will start picking on all the things I don't mean to ask. – reinierpost – 2013-10-14T18:47:44.170

I think it's cleanest to close this question (although I would really like to know the answer, looks like my only option is to compile ssh from source); I'll try to ask the other question in a second attempt. Thank you. – reinierpost – 2013-10-14T18:49:53.647

OK, but my guess is you are trying to copy things in which case rsync can do it or that you need a specific identity keyfile in which case the -i option would do it or a specific config file in which case the -F option would do it. Suit yourself though. – terdon – 2013-10-14T18:51:11.623

Yes, rsync is what I want to use this for. – reinierpost – 2013-10-14T18:52:57.753

Then post a question asking about that or read man rsync it has various options for ssh identities. – terdon – 2013-10-14T19:02:53.857

The problem is that my $HOME is on a network drive, which ssh can deal with just fine, except when running from cron. – reinierpost – 2013-10-14T19:11:18.207

Please post a question explaining the situation. You might be able to fix it by specifying a different shell for cron or by manually mounting the drive in the crontab or by various options. – terdon – 2013-10-14T19:17:31.727

let us continue this discussion in chat

– reinierpost – 2013-10-14T19:35:51.833

I solved the problem by writing a wrapper script that actually changes the user's $HOME (it's a symlink), executes the wrapped command, then changes it back; and using that in my cron job. It's a hack but it will do. – reinierpost – 2013-10-30T09:41:20.337

Nice! Could you write that up as an answer and accept it? – terdon – 2013-10-30T12:12:26.660

It isn't an answer; it's a workaround to the lack of an answer. – reinierpost – 2013-10-30T15:59:23.910

No answers