Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set up git on Synology NAS via ssh. I've created git user, set private key authentication and installed git package. I can log in successfully using private keys and have git in /opt/bin working locally (on NAS).

To make it work I changed /etc/ssh/sshd_config to have:

PubkeyAuthentication yes                                                   
AuthorizedKeysFile      .ssh/authorized_keys                               

PermitUserEnvironment yes

But I still can't make it work remotely.

The problem seem to be in path used by ssh when I execute remote commands. I can confirm that because when I do

ssh gitowner@nas.home echo \$PATH

I get

/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin

which is different from interactive shell which is giving me:

PATH='/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin'

I created .ssh/environment with following content

PATH='/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin'

but it still doesn't resolve the problem. Looks like its contents is not read.

I tried with environment file permissions set to -rw------- and -rw-r--r-- but also to no avail.

What else I could be missing sshd(?) in configuration that prevents it from reading user environment?

share|improve this question
    
Are the double quotes actually in your .ssh/environment file? –  chepner Mar 21 '13 at 13:58
    
No not really, i'll update the question. I might have tried that in despair. –  aliher Mar 21 '13 at 20:59

1 Answer 1

The solution was to try to run ssh in debug mode by running in on another port:

/usr/sbin/sshd -d -D -p 222

then running client with

ssh -v -p 222

and it became visible that it actually picks up environment. The problem was that NAS's ssh restart script

/usr/syno/etc/rc.d/S95sshd.sh restart

did't really restarted sshd, but only dropped existing connections and it failed to reread config. Once restarted, config was picked up and everything started to work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.