Put your tips and tricks online - Share your knowledge! Login | Register
 
 
  Search     Advanced search
 

Home | Ask Question | Add tip | My tips | Recent tips & tricks | Suggest a category | FAQ | Forums

 
 
 
 Category : Home > Operating Systems > Unix > Unix Utilities (General) > ssh, scp and sftp     

ssh without password


On the Client, run the ssh-keygen utility. 
Change directory to .ssh directory.
Do not enter a passphrase.

Example:

/apps/oracle/.ssh> ssh-keygen -t rsa
Enter file in which to save the key(/apps/oracle/.ssh/id_rsa): [enter]
Generating public/private rsa key pair.
Enter passphrase(empty for no passphrase): [enter]
Enter same passphrase again: [enter]
Your identification has been saved in /apps/oracle/.ssh/id_rsa.
Your public key has been saved in /apps/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
md5 1024 59:ec:ab:16:bc:7a:0a:f7:ae:d9:2d:40:f1:94:14:86
/apps/oracle/.ssh>

This generates RSA Version 2 files:
	$HOME/.ssh/id_rsa	- the private key
	$HOME/.ssh/id_rsa.pub	- the public key.

On the Server, check that the $HOME/.ssh directory exists.  The directory should have file
mode permission of 700.  If directory .ssh exits then check if there is a file
authorized_keys.  If there is a file authorized_keys then make a backup of this file.  This
backup file will be later added to a new authorized_keys file. 

/apps/oracle/.ssh> cp authorized_keys authorized_keys_bak

On the Client run scp utility to copy your public key to the server.

Example:

/apps/oracle/.ssh> scp ~/.ssh/id_rsa.pub \
servername:/apps/oracle/.ssh/authorized_keys

The authenticity of host 'servername' can't be established.
RSA key fingerprint in md5 is: 76:dc:45:b4:5d:8f:84:65:f1:3a:ae:d1:07:8c:27:2a
Are you sure you want to continue connecting(yes/no)? yes
Warning: Permanently added 'servername,10.10.0.2' (RSA) to the list of known hosts.
oracle's password: [enter the password of unix oracle user]
id_rsa.pub           100% |*********************************************************|   225  
    00:00    

On the Server

/apps/oracle/.ssh> cat authorized_keys_bak >>authorized_keys

Copy and paste authorized_keys_bak to authorized_keys.

On the Server, ensure that the Unix user’s home directory is only writable by the owner, and
does not have group or others write permissions.  If group or others write privilege is
enabled, SSH commands will always prompt for a password.

You can now use ssh, scp and sftp without password.


  Options
 
   del.icio.us  |  newsvine  |  digg  |  furl  |  google  |  yahoo  |  Ma.gnolia  |  vigillar  |  reddit  |  technorati  |  icerocket  |  pubsub

     (Average: 5 / Votes: 1)   Rate this tip:    

Start discussion or add comment to this tip

  Details
Tip reference : #160
views : 261
Added on : 02/27/07
Submited by : h8dk97
 
Send a message Send a message Printer friendly output Printer friendly output
Display this member's tips Display this member's tips (162)
 
 
 Most viewed tips 
  Databases > Oracle > Security : How to unlock Oracle user account  
  Operating Systems > Unix : How to kill Unix user session  
  Databases > Oracle > Performance Tuning : How to enable trace in Oracle  
  Databases > Oracle : Kill user session  
   
  All categories
Databases | Programming | Hardware | Operating Systems | Networking | Internet | ERP / CRM | Games & Multimedia | Graphics & Design | Miscellaneous | Office Software | TipLib FAQ
 
 

Home |  FAQ |  Terms of Use |  Privacy Policy

© 2005 tiplib.com