Feature request: change ssh user on agent
See original GitHub issueI have a git repository whose’s SSH credentials do not begin with the usual ssh://git@...
. Instead, it is ssh://root@git....
.
It seems like the agent’s behavior to clone repositories using SSH credentials is hardcoded to use git@....
.
More specifically, doing git clone ssh://git@git.myorg.net/repo/repo.git
results in permision denied, whereas doing git clone ssh://root@git.myorg.net/repo/repo.git
works just fine.
Can you please add a way to modify the SSH user for the agent?
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Feature Request: SSH agent forward key settings #1508
I would like to request an option on the host to enable Agent forwarding by default with the key already added to it....
Read more >ssh-agent - How to configure, forwarding, protocol
The ssh-agent is a helper program that keeps track of user's identity keys and their passphrases. The agent can then use the keys...
Read more >Feature request: Make the SSH agent work with any vault
Currently, the 1Password SSH agent only works with keys in the Personal or Private vaults. It would be great to expand this feature...
Read more >SSH agent restriction - OpenSSH
Most interactions with the agent are through the ssh-add tool for adding, deleting and listing keys and ssh, which can use keys held...
Read more >SSH Essentials: Working with SSH Servers, Clients, and Keys
To authenticate using SSH keys, a user must have an SSH key pair on their local computer. On the remote server, the public...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK I found two workarounds, both rather hacky. If you need a solution, you can use it, but I personally would prefer a cleaner way.
Both rely on having a
~/.ssh/config
file like the one below:One gotcha is that you need to spell out the domain as in the ssh url. People often use abbreviations like
Host gitserver
and then state the domain asHostName
. However in this case, you need the full domain as in the url asHost
and the IP of the server (might work with DNS, have not tested) asHostName
.You can test it outside of the docker container by running e.g.
git clone ssh://git.mycompany.com:2022/myuser/repo.git
. This should work outside of the container.For making this available in the docker container, we have two options.
Option 1: Own config/key with root, mount it manually The docker containers executed by the clearML agent run as
root
. Without any changes,ssh
will complain about a bad owner of the config file, even when file permissions are600
. To circumvent this, you can own the config and key asroot
. Outside of the docker container:Though now you will get an error (when running the clearML agent with
--foreground
) because your user can no longer copy the whole.ssh
folder:So in your
clearml.conf
, you need to mount the credentials manually:Option 2: Own the ssh credentials in the container Instead of owning the credentials outside and mounting them manually, you can add a command to own the credentials in the container. Adding
to your
clearml.conf
should do the trick. I prefer the second solution, but overall, the best would be if we could either have a user set when creating the task or overriding the user even when assh://
domain is given.Sry if I misunderstand - I am still new to ClearML 🙂 . Though is the commit you referenced @bmartinn really addressing the issue that @milongo mentioned?
If I see correctly, the referenced commit rewrites how https git repo urls are translated into ssh repo urls. But the issue raised by you @milongo is about ‘userless’ ssh clone links, right?
At least we have the issue that running ClearML in our git repo creates links like:
and we do not want to fix them all by hand. Alternative solutions could be changing what repo url is written when a
Task
is initialized, but solving this ‘agent-side’ would be better.