Is it possible to port Git SSHKey from one system to another

I am very new to Git. My client asked me to install git on my system and told me to pass the ssh key (id_rsa.pub). I handed over the key and it registered, after that we were able to download the application.

Then we decided to upgrade to Fedora 14 (Linux). We installed git again, and we again passed the key to register on the server to the client. But now the client has mentioned that we can use the same key.

Can I use the same key?

I tried the following steps: (As soon as git installed on Fedora.)

  • ssh-keygen -t rsa -C " your_email@youremail.com " (same email id as on Windows)
  • Replaced all 3 files created using a copy of three files (id_rsa, id_rsa.pub and known_hosts from Windows installed earlier).
  • Tried git clone git@git.xyz.com :x2.git

But no luck.

When I try:

 git clone git@git.xyz.com :x2.git Cloning into x2... ssh: connect to host git.xyz.com port 22: connection timed out fatal: The remote end hung up unexpectedly. 

Can someone help me in understanding and solving this problem? Is there any other access to blocking access?

Thanks in advance.

+4
source share
3 answers

The ssh private key is not tied to the machine, and you can simply copy it from one computer to another and be able to ssh (and therefore use git) on the public key server. You do not need to recreate the keys and replace them with copies, etc., but even what you did is excellent in terms of keys.

The error you get is ssh: connect to host git.xyz.com port 22: connection timed out fatal , which seems to suggest that the window does not have access to the server.

+5
source

As @manojlds mentioned, you can copy ssh keys. I personally did this on development machines.

The connection time is apparently due to the fact that ssh-daemon is not working. To verify that you can connect to the machine, perform the following diagnostics.

 ps -ef | grep sshd 

You should get

 root 726 1 0 08:07 ? 00:00:00 /usr/sbin/sshd -D 

If sshd is running, double-check the permissions on your keys and force the value to 0700.

 cd .ssh chmod -R 0700 * #Read only to the user only 

Try running ssh -v <user>@<host> if you get

 ssh -v 192.168.0.150 OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 192.168.0.150 [192.168.0.150] port 22. debug1: connect to address 192.168.0.150 port 22: Connection refused ssh: connect to host 192.168.0.150 port 22: Connection refused 

then there is a problem with your sshdaemon, because the initial handshake failed. A successful message is as follows:

 OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 192.168.0.xxx [192.168.0.xxx] port 22. debug1: Connection established. debug1: identity file /home/xxx/.ssh/id_rsa type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_dsa type -1 debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.6 debug1: match: OpenSSH_5.6 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA zz The authenticity of host '192.168.0.xxx (192.168.0.xxx)' can't be established. RSA key fingerprint is zzzzz. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.xxx' (RSA) to the list of known hosts. debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/parj/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: Authentication succeeded (publickey). Authenticated to 192.168.0.xxx ([192.168.0.xxx]:22). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_GB.UTF-8 Last login: Wed Dec 21 16:46:48 2011 
+2
source

LocalUser is Lu, and RemoteUser is Ru.

Lu $ mkdir ~ / .ssh

Lu $ scp usernameOfRu @ipOfRu: .ssh / *. Ssh / *

usernameOfRu @ipOfRu password: "Enter the password for the remote system"

0
source

Source: https://habr.com/ru/post/1387340/


All Articles