Under terminal, type the following command {{{ ssh-keygen -t rsa }}} Follow the instruction to generate your private and public keys, where both keys usually are stored in //yourhomefolder/.ssh// folder. Then you can upload your public key to any remote server you want to log in without typing password every time, the usual way to upload is the following command {{{ scp ~/.ssh/id_rsa.pub yourname@remote.server.com:.ssh/id_rsa.yourname.pub }}} where the first //id_rsa.pub// is your local public key, the second //id_rsa.yourname.pub// is your public key stored in remote server. The reason why we put yourname in the filename is to avoid replace the server's own public key. Last step is log into your remote server with ssh in usual way, and go to .ssh folder, and type the following command to add your key into the authorized_keys file {{{ cat id_rsa.yourname.pub >> authorized_keys }}} Log out remote server, and try log in again, you don't need to type password again, Amazing! if you have any error like **Agent admitted failure to sign using the key**. Please try command {{{ ssh-add }}} and try to connect again. Remember that in your local server: your private key and public key should be stored in file: //id_rsa// and //id_rsa.pub//, which are default file names is your //ssh_config// file. Of course, you can change their name in your preference. If you setup your .ssh/id_rsa file correctly, and you still can't login into remote server password-lessly with no error. Try {{{ ssh -v user@host }}} If you think your setting is fine, then go to server to check the ssh log file stored in //~/etc~/auth.log// and if you see error like {{{ Authentication refused: bad ownership or modes for directory }}} Then you need to change the mode of the directory of //.ssh// and the file //.ssh~/authorized_keys// using commands {{{ chmod 700 .ssh chmod 600 .ssh/authorized_keys }}} **Remark** SSH doesn’t like it if your home or .ssh directories have group write permissions. Your home directory should be writable only by you, .ssh should be 700, and authorized_keys should be 600 : === References [[http://www.daveperrett.com/articles/2010/09/14/ssh-authentication-refused/|SSH Authentication Refused: Bad Ownership or Modes for Directory]]