اتصال به ssh بدون نیاز به وارد کردن نام کاربری و کلمه عبور

علی ذوالفقار
1399/01/26 07:18:55 (800)
  • Step 1: Create Authentication SSH-Kegen Keys on local machine :
      ssh-keygen -t rsa

      Your identification has been saved in /home/ali/.ssh/id_rsa.
      Your public key has been saved in /home/ali/.ssh/id_rsa.pub.

  • Step 2: Create .ssh Directory on remote machine :
      ssh root@myserver mkdir -p .ssh
      or
      login to remote then create .ssh folder in ~/

  • Step 3: Upload Generated Public Keys to remote machine
      cat .ssh/id_rsa.pub | ssh root@myserver 'cat >> .ssh/authorized_keys'
      or
      ssh-copy-id -i .ssh/id_rsa_pub root@myserver or
      edit ~/.ssh/authorized_keys
      and past the .ss/id_rsa.pub

  • Step 4: Set Permissions on remote
      ssh root@myserver "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
      or login to remote
      chmod 700 .ssh
      chmod 640 .ssh/authorized_keys

  • Step 5: Login from local to remote Server without Password
      ssh root@myserver

Back