Chinaunix首页 | 论坛 | 博客 登录 | 注册
  • 博客访问: 899554
  • 博文数量: 1812
  • 博客积分: 90800
  • 博客等级: 元帅
  • 技术积分: 22390
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 18:35
文章分类

全部博文(1812)

文章存档

2008年(1812)

我的朋友

分类:

2008-05-03 20:15:24

技术文章


SSH
的一些安全小技巧

----------------------------------------------------

, 前言

关于 ssh 的好处, 相信不用我多说了吧?
简而言之, 之前的 rpc command telnet 都全可用 ssh 代替
.
比方如下的这些常见功能
:
-
远程登录

ssh user@remote.machine
-
远程执行
ssh user@remote.machine 'command ...'
-
远程粗?
scp user@remote.machine:/remote/path /local/path
scp /local/path
user@remote.machine:/remote/path
- X forward
ssh -X
user@remote.machine
xcommand ...
- Tunnel / Portforward
ssh -L 1234:remote.machine:4321
user@remote.machine
ssh -R 1234:local.machine:4321
user@remote.machine
ssh -L 1234:other.machine:4321
user@remote.machine

至于详细的用法, 我这就不说了. 请读者自行研究吧.
我这里要说的, 是针对 ssh 服务为大家介绍一些安全技巧, 希望大家用得更安心些
.


, 实作


(
实作以 RedHat 9 为范例)

1)
禁止 root 登录

# vi /etc/ssh/sshd_config
PermitRootLogin no


2)
废除密码登录, 强迫使用 RSA 验证(假设 ssh 账户为 user1 )

# vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
# service sshd restart
# su - user1
$ mkdir ~/.ssh 2>/dev/null
$ chmod 700 ~/.ssh
$ touch ~/.ssh/authorized_keys
$ chmod 644 ~/.ssh/authorized_keys

--------------------------------------------------
转往 client :
$ ssh-keygen -t rsa
(
按三下 enter 完成


SSH
的一些安全小技巧

----------------------------------------------------

, 前言

关于 ssh 的好处, 相信不用我多说了吧?
简而言之, 之前的 rpc command telnet 都全可用 ssh 代替
.
比方如下的这些常见功能
:
-
远程登录

ssh user@remote.machine
-
远程执行
ssh user@remote.machine 'command ...'
-
远程粗?
scp user@remote.machine:/remote/path /local/path
scp /local/path
user@remote.machine:/remote/path
- X forward
ssh -X
user@remote.machine
xcommand ...
- Tunnel / Portforward
ssh -L 1234:remote.machine:4321
user@remote.machine
ssh -R 1234:local.machine:4321
user@remote.machine
ssh -L 1234:other.machine:4321
user@remote.machine

至于详细的用法, 我这就不说了. 请读者自行研究吧.
我这里要说的, 是针对 ssh 服务为大家介绍一些安全技巧, 希望大家用得更安心些
.


, 实作


(
实作以 RedHat 9 为范例)

1)
禁止 root 登录

# vi /etc/ssh/sshd_config
PermitRootLogin no


2)
废除密码登录, 强迫使用 RSA 验证(假设 ssh 账户为 user1 )

# vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
# service sshd restart
# su - user1
$ mkdir ~/.ssh 2>/dev/null
$ chmod 700 ~/.ssh
$ touch ~/.ssh/authorized_keys
$ chmod 644 ~/.ssh/authorized_keys

--------------------------------------------------
转往 client :
$ ssh-keygen -t rsa
(
按三下 enter 完成

技术文章 linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧linux SSH 的一些安全小技巧
阅读(166) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~