Setting SSH in unix
What is SSH
(SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel.
Login session and remote execution
When the user’s identity has been accepted by the server, the server either executes the given command, or logs into the machine and gives the user a normal shell on the remote machine. All communication with the remote command or shell will be automatically encrypted.
How to set up SSH to login from one server to another?
Let’s begin
First, install OpenSSH on two UNIX machines, Let us name them as Argon and Boron .
On each machine type ssh workingmachine.com(example) and make a connection with your regular password. This will create a .ssh dir in your home directory with the proper perms.
On your primary machine where you want your secret keys to live (let’s say Argon), type
ssh-keygen -t dsa
This will prompt you for a secret passphrase. If this is your primary identity key, make sure to use a good passphrase. If this works right you will get two files called id_dsa and id_dsa.pub in your .ssh dir. Note: it is possible to just press the enter key when prompted for a passphrase, which will
make a key with no passphrase. This is a Bad Idea for an identity key, so try to avoid! See below for uses of keys without passphrases.
scp ~/.ssh/id_dsa.pub boron:.ssh/authorized_keys2
Copy the id_dsa.pub file to the other host’s .ssh dir with the name authorized_keys2.
Now boron is ready to accept your ssh key. How to tell it which keys to use? The ssh-add command will do it. For a test, type
ssh-agent sh -c ‘ssh-add < /dev/null && bash’
This will start the ssh-agent, add your default identity(prompting you for your passphrase), and spawn a bash shell. From this new shell you should be
able to:
ssh boron
This should let you in without typing a password or passphrase. Yuppie! You can ssh and scp all you want from this bash shell and not have to type any password or passphrase.
No related posts.
Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is fantastic, as well as the content!
Glad to be one of several visitants on this wonderful internet internet site : D.
Hiya, I’m really glad I have found this info. Nowadays bloggers publish only about gossips and net and this is really frustrating. A good blog with exciting content, this is what I need. Thanks for keeping this website, I’ll be visiting it. Do you do newsletters? Can’t find it.
Good post! I have a random question for you. How do you get your blog indexed by bing? I have a related web blog.
I have some trouble to subscribe the rss feed, anyway Ive bookmarked this site, is very useful and full of informations.
I’d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!
I just wanted to comment and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more in the future