{"id":6284,"date":"2022-12-07T07:49:07","date_gmt":"2022-12-06T22:49:07","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=6284"},"modified":"2023-04-23T18:07:31","modified_gmt":"2023-04-23T09:07:31","slug":"ssh%e3%81%a7%e9%8d%b5%e8%aa%8d%e8%a8%bc%e3%81%a7%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/6284","title":{"rendered":"SSH\u3067\u30ea\u30e2\u30fc\u30c8\u306e\u30de\u30b7\u30f3\u3092\u7ba1\u7406\u3059\u308b\uff01\uff08\u9375\u8a8d\u8a3c\uff0fsudo\u30d1\u30b9\u30ef\u30fc\u30c9\u306a\u3057\u8a2d\u5b9a\uff09"},"content":{"rendered":"<p>SSH\u3067\u30ea\u30e2\u30fc\u30c8\u306e\u30de\u30b7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306b\u3001\u9375\u8a8d\u8a3c\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067sudo\u53ef\u80fd\u306a\u8a2d\u5b9a\u3092\u884c\u3046\u65b9\u6cd5\u3067\u3059\u3002\u30ea\u30e2\u30fc\u30c8\u306e\u30de\u30b7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u306e\u306b\u3001\u4e00\u3064\u4e00\u3064\u30d1\u30b9\u30ef\u30fc\u30c9\u5165\u529b\u3059\u308b\u306e\u3092\u56de\u907f\u3057\u305f\u308a\u3001\u30b7\u30a7\u30eb\u306a\u3069\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u304d\u304b\u308c\u305a\u306b\u30ea\u30e2\u30fc\u30c8\u30de\u30b7\u30f3\u4e0a\u3067\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u306e\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u3067\u306f\u3001\u300cusradmin\u300d\u3068\u3044\u3046\u30e6\u30fc\u30b6\u306b\u3064\u3044\u3066\u3001\u9375\u8a8d\u8a3c\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067sudo\u3067\u304d\u308b\u74b0\u5883\u3092\u6574\u5099\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>SSH\u306e\u9375\u3092\u751f\u6210\u3059\u308b\uff01<\/h2>\n<p>\u9375\u8a8d\u8a3c\u3059\u308b\u305f\u3081\u306e\u9375\u3092ssh-keygen\u30b3\u30de\u30f3\u30c9\u3067\u751f\u6210\u3057\u307e\u3059\u3002\u300c-C\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u3001\u30b3\u30e1\u30f3\u30c8\u3067\u5fc5\u9808\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u9375\u306e\u7528\u9014\u304c\u5206\u304b\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002RSA\u3001ECDSA\u3001ED25519\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b3\u7a2e\u985e\u7528\u610f\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mkdir ~\/kms\/ssh_usradmin\r\n$ chmod 600 ~\/kms\/ssh_usradmin\r\n$ cd ~\/kms\/ssh_usradmin\r\n$ ssh-keygen -t rsa -b 4096 -C &quot;usradmin@server01&quot;\r\n$ ssh-keygen -t ecdsa -b 521 -C &quot;usradmin@server01&quot;\r\n$ ssh-keygen -t ed25519 -C &quot;usradmin@server01&quot;\r\n<\/pre>\n<p>\u57fa\u672c\u7684\u306b\u306f\u3001ED25519\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4e21\u7acb\u3067\u304d\u3066\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u9375\u3092\u751f\u6210\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30b7\u30a7\u30eb\u5316\u3057\u3066\u304a\u304f\u3068\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u3001\u300cmake_ssh_keys.sh\u300d\u3068\u3057\u3066\u3001\u518d\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u30b7\u30a7\u30eb\u5316\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>Git\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\uff01<\/h2>\n<p>\u751f\u6210\u3057\u305f\u9375\u306f\u3001Git\u3067\u7ba1\u7406\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u3001Rocky Linux\u3067\u306e\u4f8b\u3067\u3059\u3002Git\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304b\u3089\u521d\u671f\u8a2d\u5b9a\u307e\u3067\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo dnf install git\r\n$ git --version\r\ngit version 2.31.1\r\n$ git config --global user.email &quot;lab4ict@gmail.com&quot;\r\n$ git config --global user.name &quot;Lab4ict Webmaster&quot;\r\n$ git init\r\n<\/pre>\n<h2>Git\u306b\u9375\u3092\u767b\u9332\u3059\u308b\uff01<\/h2>\n<p>Git\u306b\u9375\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,17,18,33,43,46]; title: ; notranslate\" title=\"\">\r\n$ git status\r\nOn branch master\r\n\r\nNo commits yet\r\n\r\nUntracked files:\r\n  (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)\r\n\tid_ecdsa\r\n\tid_ecdsa.pub\r\n\tid_ed25519\r\n\tid_ed25519.pub\r\n\tid_rsa\r\n\tid_rsa.pub\r\n\tmake_ssh_keys.sh\r\n\r\nnothing added to commit but untracked files present (use &quot;git add&quot; to track)\r\n$ git add *\r\n$ git status\r\nOn branch master\r\n\r\nNo commits yet\r\n\r\nChanges to be committed:\r\n  (use &quot;git rm --cached &lt;file&gt;...&quot; to unstage)\r\n\tnew file:   id_ecdsa\r\n\tnew file:   id_ecdsa.pub\r\n\tnew file:   id_ed25519\r\n\tnew file:   id_ed25519.pub\r\n\tnew file:   id_rsa\r\n\tnew file:   id_rsa.pub\r\n\tnew file:   make_ssh_keys.sh\r\n\r\n$ git commit -m &quot;First Version&quot;\r\n&#x5B;master (root-commit) e5fa67f] First Version\r\n 7 files changed, 76 insertions(+)\r\n create mode 100644 id_ecdsa\r\n create mode 100644 id_ecdsa.pub\r\n create mode 100644 id_ed25519\r\n create mode 100644 id_ed25519.pub\r\n create mode 100644 id_rsa\r\n create mode 100644 id_rsa.pub\r\n create mode 100755 make_ssh_keys.sh\r\n$ git status\r\nOn branch master\r\nnothing to commit, working tree clean\r\n$ git ls-files\r\nid_ecdsa\r\nid_ecdsa.pub\r\nid_ed25519\r\nid_ed25519.pub\r\nid_rsa\r\nid_rsa.pub\r\nmake_ssh_keys.sh\r\n<\/pre>\n<h2>\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u9375\u3092\u767b\u9332\u3059\u308b\uff01<\/h2>\n<p>\u9375\u3092\u672c\u683c\u7684\u306b\u7ba1\u7406\u3059\u308b\u5834\u5408\u306f\u3001\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u767b\u9332\u3059\u308b\u3068\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001GitLab\u306b\u4f5c\u6210\u6e08\u307f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u767b\u9332\u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2,3]; title: ; notranslate\" title=\"\">\r\n$ git remote add origin http:\/\/gitlab.lab4ict.local\/key-management\/ssh_usradmin.git\r\n$ git branch -M main\r\n$ git push -uf origin main\r\nUsername for 'http:\/\/gitlab.lab4ict.local': root\r\nPassword for 'http:\/\/root@gitlab.lab4ict.local': \r\nEnumerating objects: 9, done.\r\nCounting objects: 100% (9\/9), done.\r\nCompressing objects: 100% (9\/9), done.\r\nWriting objects: 100% (9\/9), 4.32 KiB | 2.16 MiB\/s, done.\r\nTotal 9 (delta 0), reused 0 (delta 0), pack-reused 0\r\nTo http:\/\/gitlab.lab4ict.local\/key-management\/ssh_usradmin.git\r\n + 640a1f5...e5fa67f main -&gt; main (forced update)\r\nBranch 'main' set up to track remote branch 'main' from 'origin'.\r\n<\/pre>\n<h2>\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u308b\u5074\u306b\u516c\u958b\u9375\u3092\u914d\u7f6e\u3059\u308b\uff01<\/h2>\n<p>\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u308b\u5074\u306e\u30de\u30b7\u30f3\u306e\u30e6\u30fc\u30b6\u306b\u516c\u958b\u9375\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002\u307e\u305a\u3001\u516c\u958b\u9375\u3092\u914d\u7f6e\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mkdir -p ~\/.ssh\r\n$ chmod 600 ~\/.ssh\r\nls -ld ~\/.ssh\r\ndrwx------. 2 usradmin usradmin 48 Dec  5 08:24 \/home\/usradmin\/.ssh\r\n<\/pre>\n<p>authorized_keys\u30d5\u30a1\u30a4\u30eb\u306b\u63a5\u7d9a\u3059\u308b\u30e6\u30fc\u30b6\u306e\u516c\u958b\u9375\u3092\u767b\u9332\u3057\u307e\u3059\u3002\u4ee5\u4e0bh\u3001\/tmp\u306b\u4f5c\u6210\u3057\u305f\u516c\u958b\u9375\u3092\u8ee2\u9001\u3057\u305f\u60f3\u5b9a\u3067\u3001authorized_keys\u306b\u516c\u958b\u9375\u3092\u767b\u9332\u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cat \/tmp\/id_ed25519.pub &gt;&gt; \/home\/usradmin\/.ssh\/authorized_keys\r\n<\/pre>\n<p>\u203b\u4f5c\u6210\u6e08\u307f\u306e\u300cauthorized_keys\u300d\u3092\u914d\u5e03\u3059\u308b\u624b\u9806\u3067\u3082\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u5074\u306b\u79d8\u5bc6\u9375\u3092\u914d\u7f6e\u3059\u308b\uff01<\/h2>\n<p>\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u5074\u30de\u30b7\u30f3\u306e\u30e6\u30fc\u30b6\u306b\u79d8\u5bc6\u9375\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ls -l ~\/.ssh\/id_ed25519\r\n-rw-------. 1 usradmin usradmin 419 Dec  6  2022 \/home\/usradmin\/.ssh\/id_ed25519\r\n<\/pre>\n<h2>\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ssh vmsglb01\r\nActivate the web console with: systemctl enable --now cockpit.socket\r\n\r\nLast login: Wed Dec  7 18:46:31 2022 from 10.1.1.1\r\n$\r\n<\/pre>\n<h2>\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067sudo\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\uff01<\/h2>\n<p>visudo\u30b3\u30de\u30f3\u30c9\u3067\u3001\/etc\/sudoers\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nusradmin ALL=(ALL:ALL) NOPASSWD:ALL\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>SSH\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067\u30ed\u30b0\u30a4\u30f3\u3068sudo\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308c\u3070\u3001\u30ea\u30e2\u30fc\u30c8\u304b\u3089\u304b\u306a\u308a\u697d\u306b\u7ba1\u7406\u4f5c\u696d\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3088\u308b\u81ea\u52d5\u5316\u3084Ansible\u306e\u6d3b\u7528\u3082\u5bb9\u6613\u306a\u74b0\u5883\u304c\u6574\u3063\u305f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSH\u3067\u30ea\u30e2\u30fc\u30c8\u306e\u30de\u30b7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306b\u3001\u9375\u8a8d\u8a3c\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067sudo\u53ef\u80fd\u306a\u8a2d\u5b9a\u3092\u884c\u3046\u65b9\u6cd5\u3067\u3059\u3002\u30ea\u30e2\u30fc\u30c8\u306e\u30de\u30b7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u306e\u306b\u3001\u4e00\u3064\u4e00\u3064\u30d1\u30b9\u30ef\u30fc\u30c9\u5165\u529b\u3059\u308b\u306e\u3092\u56de\u907f\u3057\u305f\u308a\u3001\u30b7\u30a7\u30eb\u306a\u3069\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u304d\u304b\u308c\u305a\u306b\u30ea\u30e2\u30fc\u30c8\u30de\u30b7\u30f3\u4e0a\u3067\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u2026<\/p>\n","protected":false},"author":1,"featured_media":642,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[175],"tags":[],"class_list":["post-6284","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lab4ict"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=6284"}],"version-history":[{"count":1,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6284\/revisions"}],"predecessor-version":[{"id":10485,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6284\/revisions\/10485"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/642"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=6284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=6284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=6284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}