本机免密码最终记录

[lee@lee200 .ssh]$ rm -rf *
[lee@lee200 .ssh]$ ls
[lee@lee200 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lee/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/lee/.ssh/id_rsa.
Your public key has been saved in /home/lee/.ssh/id_rsa.pub.
The key fingerprint is:
9d:b2:8c:d6:be:d0:10:96:26:af:f1:13:b7:10:b8:f5 lee@lee200
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|     . .         |
|    o B          |
|     B + . .     |
|    o = E o      |
|     + X +       |
|    . * *        |
|     . +         |
|        o.       |
+-----------------+
[lee@lee200 .ssh]$ ls
id_rsa  id_rsa.pub
[lee@lee200 .ssh]$ vim id_rsa.pub
[lee@lee200 .ssh]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[lee@lee200 .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[lee@lee200 .ssh]$ chmod 600 authorized_keys
[lee@lee200 .ssh]$ vi id_rsa
[lee@lee200 .ssh]$

[lee@lee200 .ssh]$
[lee@lee200 .ssh]$
[lee@lee200 .ssh]$ vim /etc/host
host.conf    hostname     hosts        hosts.allow  hosts.deny  
[lee@lee200 .ssh]$ vim /etc/hosts
[lee@lee200 .ssh]$ vim /etc/hostname
[lee@lee200 .ssh]$ vim /etc/host
host.conf    hostname     hosts        hosts.allow  hosts.deny  
[lee@lee200 .ssh]$ vim /etc/host.conf
[lee@lee200 .ssh]$ vim /etc/host.allow
[lee@lee200 .ssh]$ vim /etc/hosts.allow
[lee@lee200 .ssh]$ ssh 10.0.211.200
The authenticity of host '10.0.211.200 (10.0.211.200)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.211.200' (ECDSA) to the list of known hosts.
lee@10.0.211.200's password:
Last login: Wed Apr 29 02:37:29 2015
[lee@lee200 ~]$ exit
logout
Connection to 10.0.211.200 closed.
[lee@lee200 .ssh]$ ssh 10.0.211.200
lee@10.0.211.200's password:
Permission denied, please try again.
lee@10.0.211.200's password:
Permission denied, please try again.
lee@10.0.211.200's password:
Last failed login: Wed Apr 29 02:41:28 CST 2015 from lee200 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Wed Apr 29 02:40:52 2015 from lee200
[lee@lee200 ~]$ lee
bash: lee: command not found...
[lee@lee200 ~]$ ssh 10.0.211.200
lee@10.0.211.200's password:
Last login: Wed Apr 29 02:41:31 2015 from lee200
[lee@lee200 ~]$ ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-Q protocol_feature]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]
[lee@lee200 ~]$
[lee@lee200 ~]$ ls
Desktop  Documents  Downloads  dump  ifcfg-Auto_Ethernet  ifcfg-eno16777736  ifcfg-lo  lee  mongodb-keyfile  Music  Pictures  Public  Templates  Videos
[lee@lee200 ~]$ ll
total 20
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Desktop
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Documents
drwxrwxr-x. 2 lee  lee  4096 Apr 21 11:20 Downloads
drwxrwxr-x  5 root root   40 Apr 17 17:26 dump
-rw-r--r--  1 lee  lee   298 Apr 27 17:03 ifcfg-Auto_Ethernet
-rw-r--r--  1 lee  lee   517 Apr 27 17:03 ifcfg-eno16777736
-rw-r--r--  1 lee  lee   254 Apr 27 17:03 ifcfg-lo
drwxrwxr-x. 6 lee  lee    61 Apr  5 01:31 lee
-rwxrwxr-x  1 root root 1004 Apr 18 11:44 mongodb-keyfile
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Music
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Pictures
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Public
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Templates
drwxrwxr-x. 2 lee  lee     6 Mar  8 21:21 Videos
[lee@lee200 ~]$ pwd
/home/lee
[lee@lee200 ~]$ cd /
[lee@lee200 /]$ ll
total 48
drwxrwxr-x    2 lee  lee     6 Apr 20 17:40 atd
lrwxrwxrwx.   1 root root    7 Mar  9 04:26 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 Mar  9 00:55 boot
drwxrwxr-x    7 lee  root   67 Apr 22 21:23 data
drwxr-xr-x   20 root root 3300 Apr 29 02:08 dev
drwxr-xr-x. 140 root root 8192 Apr 29 02:08 etc
drwxr-xr-x    2 root root    6 Mar 19 01:15 hadoop-ha
drwxr-xr-x.  13 root root 4096 Apr 22 02:51 home
lrwxrwxrwx.   1 root root    7 Mar  9 04:26 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Mar  9 04:26 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 Jun 10  2014 media
drwxr-xr-x.   3 root root   17 Mar  8 21:27 mnt
drwxr-xr-x    3 root root   28 Apr 18 11:45 mysecretdirectory
drwxr-xr-x.  17 root root 4096 Apr 22 03:57 opt
dr-xr-xr-x  448 root root    0 Apr 29 02:07 proc
dr-xr-x---.   8 root root 4096 Apr 29 02:18 root
drwxr-xr-x   38 root root 1320 Apr 29 02:39 run
lrwxrwxrwx.   1 root root    8 Mar  9 04:26 sbin -> usr/sbin
drwxr-xr-x    3 root root   16 Apr 21 03:12 source
drwxr-xr-x.   2 root root    6 Jun 10  2014 srv
dr-xr-xr-x   13 root root    0 Apr 29 02:07 sys
drwxrwxrwt.  48 root root 4096 Apr 29 02:41 tmp
drwxr-xr-x.  13 root root 4096 Apr 22 17:47 usr
drwxr-xr-x.  23 root root 4096 Apr 29 02:07 var
-rw-r--r--    1 root root    4 Mar 22 21:42 zookeeper_server.pid
[lee@lee200 /]$ chmod 750 $HOME
[lee@lee200 /]$ ll
total 48
drwxrwxr-x    2 lee  lee     6 Apr 20 17:40 atd
lrwxrwxrwx.   1 root root    7 Mar  9 04:26 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 Mar  9 00:55 boot
drwxrwxr-x    7 lee  root   67 Apr 22 21:23 data
drwxr-xr-x   20 root root 3300 Apr 29 02:08 dev
drwxr-xr-x. 140 root root 8192 Apr 29 02:08 etc
drwxr-xr-x    2 root root    6 Mar 19 01:15 hadoop-ha
drwxr-xr-x.  13 root root 4096 Apr 22 02:51 home
lrwxrwxrwx.   1 root root    7 Mar  9 04:26 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Mar  9 04:26 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 Jun 10  2014 media
drwxr-xr-x.   3 root root   17 Mar  8 21:27 mnt
drwxr-xr-x    3 root root   28 Apr 18 11:45 mysecretdirectory
drwxr-xr-x.  17 root root 4096 Apr 22 03:57 opt
dr-xr-xr-x  448 root root    0 Apr 29 02:07 proc
dr-xr-x---.   8 root root 4096 Apr 29 02:18 root
drwxr-xr-x   38 root root 1320 Apr 29 02:39 run
lrwxrwxrwx.   1 root root    8 Mar  9 04:26 sbin -> usr/sbin
drwxr-xr-x    3 root root   16 Apr 21 03:12 source
drwxr-xr-x.   2 root root    6 Jun 10  2014 srv
dr-xr-xr-x   13 root root    0 Apr 29 02:07 sys
drwxrwxrwt.  48 root root 4096 Apr 29 02:41 tmp
drwxr-xr-x.  13 root root 4096 Apr 22 17:47 usr
drwxr-xr-x.  23 root root 4096 Apr 29 02:07 var
-rw-r--r--    1 root root    4 Mar 22 21:42 zookeeper_server.pid
[lee@lee200 /]$ chmod 750 $HOME
[lee@lee200 /]$ ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-Q protocol_feature]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]
[lee@lee200 /]$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
[lee@lee200 /]$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
[lee@lee200 /]$ ssh -vv localhost
OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/lee/.ssh/id_rsa type 1
debug1: identity file /home/lee/.ssh/id_rsa-cert type -1
debug1: identity file /home/lee/.ssh/id_dsa type -1
debug1: identity file /home/lee/.ssh/id_dsa-cert type -1
debug1: identity file /home/lee/.ssh/id_ecdsa type -1
debug1: identity file /home/lee/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.4
debug1: match: OpenSSH_6.4 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5-etm@openssh.com
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug2: mac_setup: found hmac-md5-etm@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
[lee@lee200 /]$ pwd
/
[lee@lee200 /]$ cd ~
-bash: cd: ~: No such file or directory
[lee@lee200 /]$ cd /~
-bash: cd: /~: No such file or directory
[lee@lee200 /]$ cd ~/
[lee@lee200 ~]$ pwd
/home/lee
[lee@lee200 ~]$ cd ~
[lee@lee200 ~]$ pwd
/home/lee
[lee@lee200 ~]$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Last login: Wed Apr 29 02:41:57 2015 from lee200
[lee@lee200 ~]$ pwd
/home/lee
[lee@lee200 ~]$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is 5b:88:28:23:74:d9:52:a9:de:fb:35:09:8f:55:fc:41.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
Last login: Wed Apr 29 02:56:06 2015 from localhost
[lee@lee200 ~]$ ssh 127.0.0.1
Last login: Wed Apr 29 02:56:50 2015 from localhost
[lee@lee200 ~]$ ssh localhost
Last login: Wed Apr 29 02:57:48 2015 from localhost
[lee@lee200 ~]$ ssh 10.0.211.200
Last login: Wed Apr 29 02:58:01 2015 from localhost
[lee@lee200 ~]$ ssh 10.0.211.200
Last login: Wed Apr 29 02:58:11 2015 from lee200
[lee@lee200 ~]$
[lee@lee200 ~]$
[lee@lee200 ~]$ echo $home

[lee@lee200 ~]$ echo $HOME
/home/lee
[lee@lee200 ~]$ cd /home/
[lee@lee200 home]$ ll
total 28
drwxr-xr-x   2 root   root      6 Apr 21 13:35 hadoop
drwxr-x---. 21 lee    lee    4096 Apr 29 02:39 lee
drwx------   3 lisi   hadoop   74 Apr  6 11:57 lisi
drwx------   5 mongo  mongo  4096 Apr 28 10:35 mongo
drwx------   6 mysql  mysql  4096 Apr 28 20:26 mysql
drwxr-xr-x   2 root   root      6 Apr  5 11:51 t1
lrwxrwxrwx   1 root   root      5 Apr  5 12:11 t3 -> t2.h1
lrwxrwxrwx   1 root   root      5 Apr  5 12:11 t4 -> t2.h1
-rw-r--r--   3 root   root     11 Apr  5 12:14 t6
-rw-r--r--   3 root   root     11 Apr  5 12:14 t7
-rw-r--r--   3 root   root     11 Apr  5 12:14 t8
drwxr-xr-x   2 u1     hadoop    6 Apr  5 11:37 tmp
drwx------   5 u1     hadoop  121 Apr  6 00:51 u1
drwx------   3 lisi   hadoop   74 Apr  5 01:25 u3
drwx------  15 hadoop hadoop 4096 Apr 27 16:49 u_hadoop
drwx------   5 u2     u2      131 Apr  6 00:51 uu2

http://stackoverflow.com/questions/7439563/hard-how-to-ssh-localhost-without-password

http://superuser.com/questions/336226/how-to-ssh-to-localhost-without-password

转载于:https://my.oschina.net/kingdelee/blog/407891

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值