SSH - Linux

最終更新日: 2026-08-29

TOP(About this memo)) > 一覧(Linux) > SSH

基本

SFTPのパスワード認証と鍵認証の違い

主なコマンド(OpenSSH)

鍵の配置パターン

パスワード認証方式を無効にする

scp

鍵の作成

~/.ssh/config の設定

    ServerAliveInterval 300
    TCPKeepAlive yes

サーバーからGitホスティングサービスへSSH接続する場合の設定例

mkdir ~/.ssh/example
ssh-keygen -t ed25519 -C admin@example.com -f ~/.ssh/example/id_ed25519 -N "" && cat ~/.ssh/example/id_ed25519.pub
# 表示された公開鍵をGitホスティングサービス側(GitHubならDeploy keys)に登録しておく
chmod 400 ~/.ssh/example/id_ed25519
vi ~/.ssh/config
    Host example
    HostName github.com
    User git
    IdentityFile ~/.ssh/example/id_ed25519
chmod 600 ~/.ssh/config

ssh-agent