0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Win10 から ubuntu20にssh自動ログイン

Last updated at Posted at 2021-12-22

■Win10側
powershell起動

C:\Users\your_account.sshに移動する。

> cd C:\Users\your_account\.ssh

keyを作成する

> ssh-keygen

The program will ask you for a file name, just press enter
It will then ask you for a passphrase, press enter again and once more to confirm

Demo-win10:.ssh demo$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/demo/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/demo/.ssh/id_rsa.
Your public key has been saved in /Users/demo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:g5SyXmke+OAmYSl4nxc4wcRnsyeDO6RE9/Q9FKlcpKY demo@demo-win10-Desktop
The keys randomart image is:
+[RSA 2048]-+
|   ..    .oo     |
|  .oo =. .+      |
| . .+*o=o=       |
|. ..oB=== o      |
|o.=o*.E+S  .     |
| +.=oO o .       |
|  . *.+          |
|   o .           |
|                 |
+-[SHA256]—–+

ssh-agentを有効にする
(管理者権限でPowershellを起動する)

> Get-Service ssh-agent
Status   Name               DisplayName
------   ----               -----------
Stopped  ssh-agent          OpenSSH Authentication Agent

> Get-Service ssh-agent | Select StartType
StartType
---------
Disabled

> Get-Service -Name ssh-agent | Set-Service -StartupType Manual

> Start-Service ssh-agent

Add the keys to the local Windows 10 keystore

> ssh-add .\id_rsa

PuttyやTeraterm等で公開鍵(id_rsa.pub)の中身をubuntu(/home/you/.ssh/authorized_keys)にコピーする。

ログインする。

> ssh demo@demo-desktop

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?