I want to use the same SSH key to access multiple Ubuntu servers. The reason for this is that I want to deploy our application in DEV, STAGING, PROD, LOCAL environments through a CI server. We use Ubuntu servers in these environments. The tech lead asked me to generate one key and use it for all the servers to make the continuous integration easy.

We useTeamcity for CI and the Teamcity server and its agents run in the same Windows server.

I have generated id_rsa and id_rsa.pub key pairs in one server (LOCAL server).

The next step is to copy id_rsa.pub to all the other servers and upload the id_rsa file to the Teamcity server.

I assume that since now the Teamcity server has the id_rsa key it should be able to ssh to Ubuntu servers and issue commands through SSH Exec (Deployer plugin).

Could someone tell me from the SSH key point of view what I have done and assumed so far is correct? The remote servers are Ubuntu and the client (Teamcity server) is a Windows server.

As I have described above I tried to connect to the server where I generated the keys from the city server. I this case, I uploaded the id_rsa to the teamcity server and tried to connect. I have given the following as the path to the id_rsa file. I verified that the file actually resided in the following location:

E:\BuildServerConfig\config\projects\MyProject\pluginData\ssh_keys where E:\BuildServerConfig is the Data directory.

But I got the following error

com.jcraft.jsch.JSchException: java.io.FileNotFoundException: E:\BuildServerConfig\config\projects\MyProject\pluginData\ssh_keys (The system cannot find the path specified)

I know the path is optional, when I removed the path it gave the following error

Unexpected error: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'path' of jetbrains/buildServer/util/FileUtil.resolvePath must not be null

Could some please enlighten me on this?

  • 1
    Personally I would be a little concerned about having a single key that could access all environments, not matter how 'easy' it makes your tech lead's job!
    – Michael B
    Sep 8 '15 at 0:11

I know nothing about Teamcity and would defer to Catbird55's answer regarding the server. However, on the Ubuntu side, it's not enough to just copy the id_rsa.pub file to the remote servers. You need to determine the userid that Teamcity will be using to connect to the servers, and then add the contents of id_rsa.pub to the authorized_keys for that user:

cat /path/to/id_rsa.pub >> ~teamcityuser/.ssh/authorized_keys

And probably set some permissions if authorized_keys did not already exist:

chown teamcityuser ~teamcityuser/.ssh/authorized_keys
chmod 600 ~teamcityuser/.ssh/authorized_keys

Could someone tell me from the SSH key point of view what I have done and assumed so far is correct?

I think there is a problem.

You say the path is optional. The Java application expects a file to be here:


But the readers of this post don't know if a copy exists there. You do say you put the file here:


I would do one of two things:

1) Can the code be modified to look for "MyProject's subfolder pluginData instead of BeyondBank's pluginData? If not, use option two: 2) Can the ssh_keys file be placed in MyProject subfolder pluginData?

  • It should be "MyProject" everywhere. Sorry about that. Sep 9 '15 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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