{"id":1854,"date":"2025-08-15T10:48:09","date_gmt":"2025-08-15T01:48:09","guid":{"rendered":"https:\/\/www.typea.info\/blog\/?p=1854"},"modified":"2025-08-15T10:48:09","modified_gmt":"2025-08-15T01:48:09","slug":"ubunt_multipass_ssh_connect","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2025\/08\/15\/ubunt_multipass_ssh_connect\/","title":{"rendered":"Multipass Ubuntu SSH\u63a5\u7d9a\u8a2d\u5b9a\u307e\u3068\u3081"},"content":{"rendered":"<h1>Multipass Ubuntu SSH\u63a5\u7d9a\u8a2d\u5b9a\u307e\u3068\u3081<\/h1>\n<p>\u3053\u306e\u30da\u30fc\u30b8\u306f\u3001<strong>Multipass \u4e0a\u306e\u4eee\u60f3Ubuntu\u306b\u30d6\u30ea\u30c3\u30b8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7d4c\u7531\u3067SSH\u63a5\u7d9a<\/strong>\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u624b\u9806\u3092\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<h2>1. Multipass\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u8d77\u52d5\u3068\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a<\/h2>\n<pre><code># \u4f8b: \u30d6\u30ea\u30c3\u30b8\u30e2\u30fc\u30c9\u3067\u8d77\u52d5\uff08\u30db\u30b9\u30c8\u306e\u7269\u7406NIC\u540d\u3092\u6307\u5b9a\uff09\nmultipass launch --name ubuntu-vm --network name=\u30d6\u30ea\u30c3\u30b8NIC\u540d\n<\/code><\/pre>\n<div class=\"note\"><strong>\u6ce8\u610f:<\/strong> \u65e2\u5b58VM\u306b\u30d6\u30ea\u30c3\u30b8\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u306f <code>multipass stop<\/code> \u2192 <code>multipass set<\/code> \u307e\u305f\u306f\u518d\u4f5c\u6210\u304c\u5fc5\u8981\u3067\u3059\u3002<\/div>\n<h2>2. SSH\u63a5\u7d9a\u8a31\u53ef\u306e\u305f\u3081\u306e\u516c\u958b\u9375\u767b\u9332<\/h2>\n<ol>\n<li>Mac\u5074\u3067\u516c\u958b\u9375\u3092\u78ba\u8a8d\uff08\u306a\u3044\u5834\u5408\u306f\u4f5c\u6210\uff09\n<pre><code># \u516c\u958b\u9375\u3068\u79d8\u5bc6\u9375\u3092\u4f5c\u6210\nssh-keygen -t rsa -b 4096\n<\/code><\/pre>\n<p>\u516c\u958b\u9375\u306f <code>~\/.ssh\/id_rsa.pub<\/code> \u306b\u3042\u308a\u307e\u3059\u3002<\/li>\n<li>\u4eee\u60f3Ubuntu\u3078\u516c\u958b\u9375\u3092\u767b\u9332\n<pre><code>multipass shell ubuntu-vm\n\n# \u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b.ssh\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210\nmkdir -p ~\/.ssh\nchmod 700 ~\/.ssh\n\n# \u516c\u958b\u9375\u3092authorized_keys\u306b\u8ffd\u52a0\necho \"\uff08Mac\u306e\u516c\u958b\u9375\u5185\u5bb9\uff09\" &gt;&gt; ~\/.ssh\/authorized_keys\n\n# \u6a29\u9650\u8a2d\u5b9a\nchmod 600 ~\/.ssh\/authorized_keys\nchmod 700 ~\/.ssh\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<div class=\"note\"><strong>\u6ce8\u610f:<\/strong> <code>~\/.ssh<\/code> \u3084 <code>authorized_keys<\/code> \u306e\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304c\u6b63\u3057\u304f\u306a\u3044\u3068 <code>Permission denied (publickey)<\/code> \u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/div>\n<h2>3. sshd_config \u306e\u78ba\u8a8d<\/h2>\n<pre><code># \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\nsudo nano \/etc\/ssh\/sshd_config\n<\/code><\/pre>\n<p>\u8a2d\u5b9a\u4f8b\uff08\u5fc5\u8981\u90e8\u5206\u306e\u307f\uff09:<\/p>\n<pre><code>PermitRootLogin no\nPubkeyAuthentication yes\nPasswordAuthentication no\nAuthorizedKeysFile .ssh\/authorized_keys\n<\/code><\/pre>\n<p>\u53cd\u6620:<\/p>\n<pre><code>sudo systemctl restart ssh\n<\/code><\/pre>\n<h2>4. SSH\u63a5\u7d9a\u30c6\u30b9\u30c8\uff08Mac\u304b\u3089\uff09<\/h2>\n<pre><code>ssh ubuntu@\u4eee\u60f3\u30de\u30b7\u30f3\u306eIP\u30a2\u30c9\u30ec\u30b9\n<\/code><\/pre>\n<p>\u63a5\u7d9a\u3067\u304d\u308c\u3070\u8a2d\u5b9a\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h2>5. \u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<ul>\n<li><code>Permission denied (publickey)<\/code> \u2192 \u516c\u958b\u9375\u306e\u767b\u9332\u3084\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092\u518d\u78ba\u8a8d<\/li>\n<li>\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u3067\u30dd\u30fc\u30c822\u304c\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d<\/li>\n<li>Multipass\u306e\u30d6\u30ea\u30c3\u30b8\u8a2d\u5b9a\u3067IP\u30a2\u30c9\u30ec\u30b9\u304c\u53d6\u5f97\u3055\u308c\u3066\u3044\u308b\u304b <code>ip addr<\/code> \u3067\u78ba\u8a8d<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Multipass Ubuntu SSH\u63a5\u7d9a\u8a2d\u5b9a\u307e\u3068\u3081 \u3053\u306e\u30da\u30fc\u30b8\u306f\u3001Multipass \u4e0a\u306e\u4eee\u60f3Ubuntu\u306b\u30d6\u30ea\u30c3\u30b8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7d4c\u7531\u3067SSH\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u624b\u9806\u3092\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002 1. Multipass\u4eee\u60f3\u30de\u30b7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[],"tags":[145,178,148],"class_list":["post-1854","post","type-post","status-publish","format-standard","hentry","tag-multipass","tag-ssh","tag-ubuntu"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1854"}],"version-history":[{"count":1,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1854\/revisions"}],"predecessor-version":[{"id":1855,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1854\/revisions\/1855"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}