linux shell将数字替换为蚊子,SSH ("Secure SHell") 介绍和无密码登陆设置

Introduction

SSH ("Secure SHell") is a protocol for securely accessing one

computer from another. Despite the name, SSH allows you to run

command line and graphical programs, transfer files, and even

create secure virtual private networks over the Internet.

To use SSH, you will need to install an SSH client on the computer

you connect from, and an SSH server on the computer you connect to.

The most popular Linux SSH client and Linux SSH server are

maintained by the OpenSSH project.

Answer

Execute these two commands:

ssh-keygen

After the key is copied, ssh into the machine as normal

ssh user@host

You can now login without entering a password from the particular

machine you executed the commands at.

Example

not-marco@rinzwind-desktop:~$ ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/not-marco/.ssh/id_rsa):

Created directory '/home/not-marco/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/not-marco/.ssh/id_rsa.

Your public key has been saved in /home/not-marco/.ssh/id_rsa.pub.

The key fingerprint is:

b1:25:04:21:1a:38:73:38:3c:e9:e4:5b:81:e9:ac:0f not-marco@rinzwind-desktop

The key's randomart image is:

+--[ RSA 2048]----+

|.o= . oo. |

|*B.+ . . |

|*=o . o . |

| = . = |

|. o S |

|E. |

| o |

| . |

| |

+-----------------+

not-marco@rinzwind-desktop:~$ ssh-copy-id not-marco@127.0.0.1

not-marco@127.0.0.1's password:

Now try logging into the machine, with "ssh 'not-marco@127.0.0.1'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Explanation

This assumes you already have successfully connected to your server

via SSH.

You'll need to generate an SSH Keypair which will allow you to

identify you as yourself without using a password. You can opt to

protect keys with a passcode if you wish, but this can be left

blank allowing totally password-less SSH access.

First create your SSH Keypair by

running ssh-keygen this

will create an id_rsa and id_rsa.pubfile.

The pub file

is what goes on the servers, the private key (id_rsa)

is what stays with you and is how you identify yourself.

Next copy the public key to your server

with ssh-copy-id

user@server replacing user with your remote

user and server with the machine DNS name or IP address. It'll

prompt for your SSH password, enter it and if all completes

successfully you'll be able to access the machine

via ssh

user@serverwithout needing a password.

References

双向访问:

http://blog.csdn.net/kongqz/article/details/6338690

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值