Can someone explain SSH tunnel in a simple way?

1) Assuming you connect from home to foo, you need a reverse tunnel (-R) ssh -R 8080:localhost:3000 foo.mycompany.com This will enable processes running at foo to connect to localhost:8080 and actually speak to your home computer at port 3000. If you want other computers at your work to be able to connect to foo:8080 and … Read more

OpenShift rhc setup using multiple accounts

The rhc command-line tools come with the global option -l, –rhlogin LOGIN. You have two options: Use the -l flag with every command to specify the login name: rhc app create <appname> <cartridge> [-l <login1/login2>] Run rhc setup -l LOGIN between the sessions. Once done managing apps from one account you can end the session … Read more

How do I add my own public key to Vagrant VM?

You can use Ruby’s core File module, like so: config.vm.provision “shell” do |s| ssh_pub_key = File.readlines(“#{Dir.home}/.ssh/id_rsa.pub”).first.strip s.inline = <<-SHELL echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys echo #{ssh_pub_key} >> /root/.ssh/authorized_keys SHELL end This working example appends ~/.ssh/id_rsa.pub to the ~/.ssh/authorized_keys of both the vagrant and root user, which will allow you to use your existing SSH key.

Connect with SSH through a proxy

Here’s how to do Richard Christensen’s answer as a one-liner, no file editing required (replace capitalized with your own settings, PROXYPORT is frequently 80): ssh USER@FINAL_DEST -o “ProxyCommand=nc -X connect -x PROXYHOST:PROXYPORT %h %p” You can use the same -o … option for scp as well, see my superuser answer. If you get this in … Read more

How can I force ssh to accept a new host fingerprint from the command line?

The answers here are terrible advice. You should never turn off StrictHostKeyChecking in any real-world system (e.g. it’s probably okay if you’re just playing on your own local home network – but for anything else don’t do it). Instead use: ssh-keygen -R hostname That will force the known_hosts file to be updated to remove the old … Read more

Putty: Getting Server refused our key Error

OK, there was a small typo in my key. Apparently when pasting to file the first letter was cut off and it started with sh-rsa instead of ssh-rsa. nrathathaus – your answer was very helpful, thanks a lot, this answer is credited to you 🙂 I did like you said and set this in sshd_conf: … Read more