分类: LINUX
2005-10-09 15:30:49
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帐号进行测试。