ユーザ用ツール

サイト用ツール


centos:ssh

文書の過去の版を表示しています。


Contents

SSH

[root@localhost ~]# useradd kodama
[root@localhost ~]# passwd kodama
Changing password for user kodama.
New UNIX password: 
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.
[root@localhost ~]# su - kodama
[kodama@localhost ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/kodama/.ssh/id_rsa): 
Created directory '/home/kodama/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/kodama/.ssh/id_rsa.
Your public key has been saved in /home/kodama/.ssh/id_rsa.pub.
The key fingerprint is:
74:cb:46:46:94:eb:73:93:f0:fd:e3:ea:7c:c5:27:e9 kodama@localhost.localdomain
[kodama@localhost ~]$ ls -al
合計 28
drwx------ 3 kodama kodama 4096  2月 12 11:35 .
drwxr-xr-x 5 root   root   4096  2月 12 11:35 ..
-rw-r--r-- 1 kodama kodama   33  2月 12 11:35 .bash_logout
-rw-r--r-- 1 kodama kodama  176  2月 12 11:35 .bash_profile
-rw-r--r-- 1 kodama kodama  124  2月 12 11:35 .bashrc
drwx------ 2 kodama kodama 4096  2月 12 11:35 .ssh
[kodama@localhost ~]$ cd ~/.ssh
[kodama@localhost .ssh]$ mv id_rsa.pub authorized_keys
[kodama@localhost .ssh]$ chmod 600 authorized_keys

sshで公開鍵認証を接続先のサーバの「~/.ssh」以下に「authorized_keys」作る

ssh-copy-id -i ~/.ssh/id_rsa.pub masuda@192.168.1.1

【memo】ssh / ssl

Secure Socket Layer (SSL)

Apache暗号化通信など 「認証局」が必要

Secure SHell protocol (SSH)

「認証局」が不要

Secure Copy (SCP)

Secure Shell (ssh) に含まれるsshの機能を使ってセキュリティの高い(セキュアな)ファイル転送を行うコマンドの 1 つ

sshで初回ログイン時に「Are you sure you want to continue connecting (yes/no)? 」を自動処理する

SSH、SCPで初回ログイン時には、以下のようなメッセージが表示されて、yesを入力する必要がある。 これを表示されない(自動処理)ようにする。

# scp /etc/hosts 192.168.10.208:/etc/
The authenticity of host '192.168.10.208 (192.168.10.208)' can't be established.
RSA key fingerprint is 4b:99:f7:72:fd:41:ed:eb:7a:c2:1d:dc:83:47:ea:d1.
Are you sure you want to continue connecting (yes/no)? 

一時的

$ ssh -oStrictHostKeyChecking=no 192.168.10.208
Warning: Permanently added '192.168.10.208' (RSA) to the list of known hosts.

恒久的

$ vi ~/.ssh/config
host *
    StrictHostKeyChecking no
centos/ssh.1385625432.txt.gz · 最終更新: 2025/02/16 13:50 (外部編集)