Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ?

share|improve this question

migrated from stackoverflow.com Aug 22 '11 at 13:23

This question came from our site for professional and enthusiast programmers.

2 Answers 2

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.
share|improve this answer
    
Thanks a ton !! :-) –  Parth_90 Aug 22 '11 at 13:22
    
Didn't even know of ssh-copy-id, very nice. –  slhck Aug 22 '11 at 13:26
    
Yeah ssh-copy-id is new for me as well. Nicely done! –  sbtkd85 Aug 22 '11 at 14:24
    
You may use keychain to get that process automatized. –  hornetbzz Aug 23 '11 at 1:50

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.

share|improve this answer
    
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 '11 at 13:16
1  
Remote login is what ssh is for. It has manuals. Read them. –  Henning Makholm Aug 22 '11 at 13:18
    
ok fine will do that... thanks a lot !! :-) –  Parth_90 Aug 22 '11 at 13:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.