How do I use a specific SSH key with SublimeGIT? - sublimetext

I am using SublimeGit and it is defaulting to the 'id_rsa' key, but there are certain repos I am working on that use a different key in my ~/.ssh/ directory. If I have 'foo_rsa', for example, I cannot find out how to have SublimeGit use a specific key when running the commands.

Related

Different SSH locations for git?

I recently reinstalled Windows on my PC. However the new SSH location on my PC is different because the username is different. When I try to sync git, it still looks for the previous ssh location.
My question is simply why is it looking for the previous location?
EDIT
I forgot to mention that I copied all my repositories and .ssh folder over.
Git will always look by default for ssh keys in %USERPROFILE%\.ssh\id_rsa(.pub).
Warning, with Git 2.19+, you need to add the -m PEM option to ssh-keygen:
ssh-keygen -t rsa -m PEM -P ""
The only way Git would look elsewhere is if you have restored your %USERPROFILE%\.ssh\config file, in which you could have set a specific path for a private key.
all it's looking for is the private key. since you reinstalled Windows, you would have lost you previous key. only option you have is to generate a new key and configure it's corresponding public key on git again.
P.S: you are incorrect in assuming that it's due to change in location or that git's even looking for your key at a certain location.

ssh-keygen without ssh access

I've got a Lacie Network Space 2 where they have disabled the SSH access and I'd like to write a script where I transfer files from my computer to the NS2 using scp.
The only problem I have is that I can't (from what I know) generate a public key without first connecting via SSH.
So my question is: Is it possible to generate a key without having access to SSH, for use with scp? Or some other clever way to transfer files to my NS2 (FW 2.2.4) using a script.
I might add that I'm currently mounting the disk and using cp, but I'd like something better.
Thanks in advance!
What exactly do you want? If you want to scp to the NS2, you'll have to generate the keys on the source machines and append it to authorized_keys on the target. Since you can already mount & use cp, you should be able to do that.
Note that since scp works over ssh, if they've disabled ssh this won't work. OTOH, if they've only disabled password based ssh, or set /bin/false as your shell, this might work.
I have concluded that if you want to gain access to ssh keys on your NS2 with a newer FW you have to remove the disk from its casing and connect it to a computer, as they explain in this link
Enabling SSH on NS2
I thank you both for your answers, but I guess I'll have to do it the hard way.

using alias instead of IP in scp

I have a desktop in the office that I often need to access from home and use scp to copy files. Currently I am doing it like this
scp username#x.x.x.x ...
I want a mechanism that I dont have to type the IP address each time I want to scp something. I was trying to do it by creating an alias, but it doesn't seem to work.
Can I give my desktop machine a name so that instead of typing the ip address I can use the name of the machine instead ?
One way to deal with this is to create an entry in your ssh configuration. This can be done on a system wide basis or, if you don't have root access on this box, just for your user.
The per user configuration file is ~/.ssh/config and uses the following format
host my_desktop
hostname 11.22.33.44
This method is also nice because you can specify other options like the user name. To find out more about the options available try man ssh_config.
You should have a HOSTS file on your system that's designed to do exactly that. On my Linux system, it's located at /etc/hosts. If you add a line that looks like this:
11.22.33.44 my_desktop
then all accesses to the name my_desktop will be mapped to the IP address listed. This change only affects the machine whose HOSTS file was modified, though. If you want to make it so that anybody can access an IP using a specific name, then you're looking at something a little more difficult (this is the general problem that DNS servers were designed to resolve).
Use a environment variable to hold your IP and username - then use the variable in the scp command.
user#crunchbang:~$ export mypc='myuser#x.x.x.x'
user#crunchbang:~$ scp $mypc: ......

What's the difference between Github and Putty SSH key placement configurations?

The github instructions say to setup your SSH keys in ~/.ssh using the windows git bash program.
I have in the past used Putty to manage ssh keys.
What is the difference between the 2 setups?
This is for my own git server.
I know this is a pretty old question, but here's the answer:
Basically, PuTTY stores all its sessions in the Windows registry, rather than in a config file in a home folder, whereas the default git+ssh setup uses openSSH and it's style of key configuration (files that are typically stored in ~/.ssh, i.e., /home/<username>/.ssh).
In Windows, if you'd rather use PuTTY than openSSH, set an environment variable named GIT_SSH to C:\your\putty\folder\plink.exe. Then, you can reference any saved session in PuTTY by using a remote url of the form ssh://<session name>/<repository path>. This allows you to, for example, specify particular keys with each session, similarly to how you could use ~/.ssh/config to specify a particular key with the IdentityFile option.
Git uses an SSH program to deal with SSH accesses, basically the default one depending on your system (look at the GIT_SSH environment variable). So it's just to ease the configuration that they say to setup SSH keys in ~/.ssh. If you want to put SSH keys in another directory, just tell it by using ssh-add /path/to/your/key.

Run shell script on a remote machine in Unix without using ssh or rsh

I want to run a script on another machine. Is there anyway to do it without any kind of authentication even if I'm running it for the first time on that machine? It is assumed that the other machine is trusted. I can't use ssh as it breaks the continuous process and prompts for user password and I want that process to be continuous. Please suggest if there is any way to achieve this. I've tried everything I could using ssh but to no avail.
Since you say you don't know where the authorized keys file resides, check this setting in your sshd_config:
AuthorizedKeysFile
Specifies the file that contains the public keys that can
be used
for user authentication. AuthorizedKeysFile may contain
tokens
of the form %T which are substituted during connection
set-up.
The following tokens are defined: %% is replaced by a
literal
'%', %h is replaced by the home directory of the user
being
authenticated and %u is replaced by the username of that
user.
After expansion, AuthorizedKeysFile is taken to be an
absolute
path or one relative to the user's home directory. The
default
is ``.ssh/authorized_keys.
If it is not set, just create a .ssh dir in your home directory and add the key of the client. Unless you have any unusual settings in the sshd_config, you should now login without entering a password (unless you've password protected your key file, which is normally recommended)
In case you have trusted network you could try rlogin.
http://en.wikipedia.org/wiki/Rlogin

Resources