I don't know if this is an issue with Visual Studio Code or Ubuntu or Git or SSH or Synology. Therefor I am asking this question here, on the site I consider to be the jack of all trades.
I have a Ubuntu desktop PC and a Synology NAS (operating system is DSM). I have installed Git server on the NAS. On the PC I have a private programming hobby project which uses Git. I have a bare-repo on the NAS which acts as a Git remote for the project. The remote was added with the command git remote add origin ssh://gituser@192.168.XXX.XXX:/path/to/remote/repository/name.git
. I have created a private-public key on the PC and the public-key has been moved to the NAS to path ~/.ssh/authorized_keys
of the gituser.
On the PC, if I manually cd
my way into the Git-project folder and use git push
, then the remote server asks me my Synology password, I enter it, press ENTER and everything works. I can also clone the remote to another location on my PC and it works.
However, if I launch Visual Studio Code and open the project as a folder, then I get very quickly IP-banned by the Synology NAS due to exceeding the maximum allowed amount of failurous login attemps.
So the question is: What is going wrong here and how do I make it work?
I am guessing this happens because VSCode tries to fetch possible updates from the remote automatically but fails to do so because DSM demands a password. I tried to add the line PasswordAuthentication no
to /etc/ssh/sshd_config
on the NAS but this didn't do anything.
I did manage to make everything work. I'm not sure what it was that finally solved this but what I did:
I decided to use my admin account for the Git remote connection.
I used sudo chmod 700
on /volume1/homes/adminaccount
and /volume1/homes/adminaccount/.ssh/
and /volume1/homes/adminaccount/.ssh/authorized_keys
.
I edited /etc/ssh/sshd_config
and unommented #PubkeyAuthentication yes
and #AuthorizedKeysFile .ssh/authorized_keys
I edited my ~/.ssh/config
and it looks like this now:
# My NAS
Host 192.168.XXX.XXX
Port 12345
Preferredauthentications publickey
IdentityFile ~/.ssh/myrsakey
Everything seem to work. I can start Visual Studio Code, work on the project and push to the remote without getting my IP banned.
Thank you @VonC for guiding me in the right direction.