a-Column

【UNIX】SSHをパスワードなしでログインする

■シェル実行側のサーバで行う

[root@st .ssh]# su - test
[test@st test]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):(何も入力しない)
Enter same passphrase again:(何も入力しない)
Your identification has been saved in /home/test/.ssh/id_rsa.
Your public key has been saved in /home/test/.ssh/id_rsa.pub.
The key fingerprint is:
63:d9:64:63:ca:44:a7:db:39:00:3c:54:b8:24:06:57 test@st.hectour.com

[test@st test]$ scp ./.ssh/id_rsa.pub cadox@202.218.78.161:
The authenticity of host '202.218.78.161 (202.218.78.161)' can't be established.
RSA key fingerprint is 78:c2:f1:b0:ff:66:06:92:c8:3e:51:8e:de:d8:ee:62.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '202.218.78.161' (RSA) to the list of known hosts.
cadox@202.218.78.161's password:
id_rsa.pub 100% 232 4.6MB/s 00:00

■リモートの接続先でおこなう
(202.218.78.161)


[root@www .ssh]# touch authorized_keys
[root@www .ssh]# chown test.test authorized_keys
[root@www .ssh]# chmod 600 authorized_keys
[root@www .ssh]# cat /home/cadox/id_rsa.pub >> authorized_keys

Last Update : 2006年10月27日 (金) 18:38