3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id
You can login to a remote Linux server without entering password in 3 simple steps using ssky-keygen and ssh-copy-id as explained in this article.
ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.
This article also explains 3 minor annoyances of using ssh-copy-id and how to use ssh-copy-id along with ssh-agent.
ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.
This article also explains 3 minor annoyances of using ssh-copy-id and how to use ssh-copy-id along with ssh-agent.
Step 1: Create public and private keys using ssh-key-gen on local-host
jsmith@local-host$ [Note: You are on local-host here] jsmith@local-host$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key] Enter passphrase (empty for no passphrase): [Press enter key] Enter same passphrase again: [Pess enter key] Your identification has been saved in /home/jsmith/.ssh/id_rsa. Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub. The key fingerprint is: 33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host
Step 2: Copy the public key to remote-host using ssh-copy-id
jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host jsmith@remote-host's password: Now try logging into the machine, with "ssh 'remote-host'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.
Step 3: Login to remote-host without entering the password
jsmith@local-host$ ssh remote-host Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2 [Note: SSH did not ask for password.] jsmith@remote-host$ [Note: You are on remote-host here]
The above 3 simple steps should get the job done in most cases.
相關文章
- ssh-keygen & ssh-copy-id實現兩去臺linux機器之間無密碼通訊Linux密碼
- docker_sshd without passwordDocker
- REMOTE_LOGIN_PASSWORDREM
- Linux命令ssh-copy-idLinux
- Clear Windows XP login passwordWindows
- SSH steps of developingdev
- bash: ssh-copy-id: command not found...
- Git上傳採坑之ssh-keygenGit
- ssh-copy-id三步實現SSH免密登入
- Rsync over SSH with No Password (Crontab)
- Linux 命令(210)—— ssh-copy-id 命令Linux
- Linux - 配置SSH免密登入 - “ssh-keygen”的基本用法Linux
- Linux之ssh-copy-id免密登入Linux
- VMware infrastructure web access 的login name和passwordASTStructWeb
- vmware server web access的login name和passwordServerWeb
- Exact Steps To Migrate ASM Diskgroups To Another SAN Without DowntimeASM
- 如何在TortoiseGit中使用ssh-keygen生成的keyGit
- Export a DataSet to Microsoft Excel without using the COM objectsExportROSExcelObject
- Access denied for user 'root'@'localhost' (using password: NO)localhost
- ERROR 1045 (28000): using password: YESError
- git ssh金鑰生成過程中ssh-keygen不是內部或外部命令Git
- 使用ssh-keygen,實現免密碼登陸linux密碼Linux
- 【expect】用expect實現scp/ssh-copy-id的非互動
- 翻譯 | Learning React Without Using React Part 2React
- 翻譯 | Learning React Without Using React Part 1React
- Import Data From MS Excel to DataSet without using COM ObjectsImportExcelObject
- #1045 - Access denied for user 'root'@'localhost' (using password: NO)localhost
- Perform 3D地震抵抗設計ORM3D
- OBIEE 11g users still able to login even with invalid password
- SSH-keygen rsa 金鑰對根據私鑰生成公鑰
- mysql 1045, "Access denied for user 'root'@'localhost' (using password: NO)"MySqllocalhost
- [Mac]解決mac機器上沒有ssh-copy-id的問題Mac
- Connect SQL Server from Linux Client using Windows Authentication and troubleshoot stepsSQLServerLinuxclientWindows
- MYSQL解決error: 'Access denied for user 'root'@'localhost' (using password:MySqlErrorlocalhost
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)Errorlocalhost
- Using UTL_FILE Package To Perform File I/O (UNIX) And Basic FAQ_44307.1PackageORM
- 測試oracle 11.2.0.4的remote_login_password引數含義OracleREM
- 無法使用SQL login去登陸SQL Server - 'Password did not match'SQLServer