Chinaunix首页 | 论坛 | 博客
  • 博客访问: 579983
  • 博文数量: 112
  • 博客积分: 5090
  • 博客等级: 大校
  • 技术积分: 1158
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-19 22:21
文章分类

全部博文(112)

文章存档

2016年(1)

2015年(1)

2012年(1)

2011年(5)

2010年(7)

2009年(6)

2008年(18)

2007年(28)

2006年(16)

2005年(29)

我的朋友

分类: LINUX

2005-10-09 15:30:49

如果你在家里或者其它地方,怎样控制你的服务器,你可能会想到用telnet,本来是可以的,但是由于telnet用的是明码传输,容易给那些不怀好意者可乘之机,所以我们用openssh来代替telnet

openssh的设置
1]
卸载原来的2.9x版,2.9x版有bug,不安全:
rpm –e openssh

2]
最新软件包下载:



3]安装软件:
tar zxvf openssh-3.4p1.tar.gz
cd openssh-3.41
./configure --prefix=/usr/local/ssh
--sysconfdir=/etc/ssh
--with-tcp-wrappers
--with-ipv4-default
--with-md5-passwords
make
make install
注:安装完成以后,会自动生成主机密钥,还会提示需要sshd用户帐号,可用useradd加一个sshd用户。
install /contrib/redhat/sshd.pam /etc/pam.d/sshd
cp contrib/redhat/sshd.init /etc/rc.d/init.d/sshd
chkconfig --level 3 sshd on
;配置成系统服务


4]
配置openssh/etc/ssh/ssh_config文件

vi /etc/ssh/ssh_config
Host *
ForwardAgent no
ForwardX11 no
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
BatchMode no
CheckHostIP yes
StrictHostKeyChecking ask
IdentityFile ~/.ssh/identity
Port 22
Cipher 3des
EscapeChar ~

5]
配置openssh/etc/ssh/sshd_config文件
vi /etc/ssh/sshd_config
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
KeyRegenerationInterval 3600
ServerKeyBits 768
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 600
#PermitRootLogin yes
#还是不要让root直接登录为妙!
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
RhostsAuthentication no
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
IgnoreUserKnownHosts no
PasswordAuthentication yes
PermitEmptyPasswords no
Subsystem sftp /usr/local/ssh/libexec/sftp-server

6]
配置用户的加密密钥

useradd test
passwd test
su test
ssh-keygen -d
出现提示请回车并输入passwd,再次输入passwd

注:这个密码是系统加密运算时用到的,登录时还用原来密码。


7]
启动服务

/etc/rc.d/init.d/sshd start

8]
在客户端用test帐号进行测试。

阅读(1262) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~