您的位置:首页 > 运维架构

How to ssh on Debian

2011-09-10 00:00 288 查看
How to ssh on Debian

1. installation

>>> apt-get install ssh

PS: This is a convenient way to install both the OpenSSH client and the OpenSSH sever.

More details: aptitude show ssh

OR:

>>> apt-get install openssh-sever openssh-client

2. Generating public/private key

>>> ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Created directory '/root/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

f5:ce:6e:8c:0c:75:f2:37:6a:17:10:3b:f4:d6:5d:5b root@debX

The key's randomart image is:

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

| |

| o E|

| .. + .=|

| .o.= o.o|

| S. +.+ |

| . o. + |

| o ooo o |

| o.= . |

| o.. |

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

OR:

>>> ssh-keygen -t rsa

3. Configure SSH server/client

3.1 Server:

>>> mkdir $HOME/.ssh

>>> cp id_rsa.pub $HOME/.ssh/authorized_keys

PS: $HOME means the $HOME of the remote user

i.e. /home/rugby/

3.2 Client:

>>> mkdir ~/.ssh

>>> scp root@remote:/root/.ssh/id_rsa ~/.ssh/

4. Secure issues

Server:

>>> vi /etc/ssh/sshd_config

Port <Number > 1024>

PermitRootLogin no

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile %h/.ssh/authorized_keys

ChallengeResponeAuthentication no

PasswordAuthentication no

Client(auto-login):

>>> vi ~/.ssh/config

Host <Server Name>

HostName <IP Address>

Port <Number > 1024>

User <Remote User>

5. Get Started

>>> ssh user@host

>>> scp user@host:/path/to/file ./

PS: host means server name, not ip address
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SSH OpenSSH Debian scp