1

I am new to the Linux operating system. I am using Red Hat Linux.

Can anyone tell me how to use remote services to login to a remote machine without providing the password?

Are there any commands in Linux or do I have to write a 'C' code for it ?

2 Answers 2

8

You do not have to write code.

First generate your key pair by

ssh-keygen

Second, use ssh-copy-id to distribute your public key

ssh-copy-id username@remote-machine

Note that you need to provide your password when running this command. After that, you can login the remote machine without password.

Here are some explanations for the commands from the manual page:

ssh-keygen

 ssh-keygen generates, manages and converts authentication keys for
 ssh(1).  ssh-keygen can create RSA keys for use by SSH protocol version 1
 and DSA, ECDSA or RSA keys for use by SSH protocol version 2.  The type
 of key to be generated is specified with the -t option.  If invoked with-
 out any arguments, ssh-keygen will generate an RSA key for use in SSH
 protocol 2 connections.

ssh-copy-id

 ssh-copy-id  is  a  script  that  uses  ssh  to  log into a remote machine
 and append the indicated identity file to that machine's
 ~/.ssh/authorized_keys file.
3
  • Didn't even know of ssh-copy-id, very nice.
    – slhck
    Aug 22, 2011 at 13:26
  • Yeah ssh-copy-id is new for me as well. Nicely done!
    – sbtkd85
    Aug 22, 2011 at 14:24
  • You may use keychain to get that process automatized.
    – hornetbzz
    Aug 23, 2011 at 1:50
1

Look into ssh, which can authenticate a login by using a public-key pair where you store the private part on the local machine and the public part on the remote one.

2
  • Can u tell me how to use ssh for remote login ? I get ur point just since I am new , I would like to know what code should I write to do my task
    – Parth_90
    Aug 22, 2011 at 13:16
  • 1
    Remote login is what ssh is for. It has manuals. Read them. Aug 22, 2011 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .