openssh tip

# $OpenBSD: sshd_config,v 1.59 2002/09/25 11:17:16 markus Exp $
# $FreeBSD: src/crypto/openssh/sshd_config,v 1.4.2.13 2003/09/24 19:28:35 des Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

# Note that some of FreeBSD's defaults differ from OpenBSD's, and
# FreeBSD has a few additional options.

#VersionAddendum FreeBSD-20030924

Port 22
#监听的端口

#Protocol 2,1
Protocol 2
#需用的ssh版本

#ListenAddress 192.168.1.254
绑定的地址

#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_dsa_key

#主机所使用的key
#ssh 1 使用/etc/ssh/ssh_host_key
#ssh 2 使用/etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#这个设置只针对ssh 1版本
KeyRegenerationInterval 3600
#服务器key生存的时间,单位是秒
ServerKeyBits 768
#key的长度

# Logging
#obsoletes QuietMode and FascistLogging
SyslogFacility AUTH
LogLevel INFO


# Authentication:

LoginGraceTime 600
#连接后输入密码的时间,单位为秒,这个是默认,长了点,建议弄短点,10分钟让你输密码?
PermitRootLogin no
#root是否可以远程登录,建议使用ssh 1的时候,不要打开
#如果为without-password,root用密码不能登录,但可以用key登录
StrictModes yes
#检查用户家目录和rhosts文件的权限和所有权,如果其它人可以写,就拒绝使用

#RSAAuthentication yes
#只使用RSA认证,只针对ssh 1版本
PubkeyAuthentication yes
#使用Pubkey认证,使用ssh 2必须打开,只针对ssh 2版本
AuthorizedKeysFile .ssh/authorized_keys
#key的路径和名字

# rhosts authentication should not be used
RhostsAuthentication no
#使用基于rhosts的安全验证,不需要.

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
#不使用~/.rhosts ~/.shosts,这2个文件进行认证

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
#使用rhost文件认证,只针对ssh 1

# similar for protocol version 2
HostbasedAuthentication no
#使用rhost文件认证,只针对ssh 2

# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#不使用~/.ssh/known_hosts文件,我们要使用,选no,默认也是no
#IgnoreUserKnownHosts no

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#是否使用口令验证,使用ssh 2要关闭

PermitEmptyPasswords no
#使用空口令,默认关闭

# Change to no to disable PAM authentication
ChallengeResponseAuthentication no
#任何的密码认证,我们使用key认证,关闭,这个默认是yes.使用key认证,必须关闭

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

#AFSTokenPassing no

# Kerberos TGT Passing only works with the AFS kaserver
#KerberosTgtPassing no

#X11Forwarding yes
X11Forwarding no
#设置是否允许X11转发,默认是允许的
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost no
#使用本地主机
#PrintMotd yes
#显示motd文件的内容
#PrintLastLog yes
#显示最后登录的信息,默认是打开的
#KeepAlive yes

#UseLogin no

#UsePrivilegeSeparation yes

#PermitUserEnvironment no
#使用帐号环境

#Compression yes
#压缩数据,默认压缩

#MaxStartups 10
#最大的未登录连接数目,建立弄的大一点
# no default banner path
#Banner /some/path
#VerifyReverseMapping no

# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server

AllowGroups wheel
#允许使用的组
AllowUsers
#允许使用的用户

tip~

sshd设置,请参考上面的配置文件
连接ssh 2
1.生成ssh2使用的key
ssh-keygen -t dsa

2.cp id_dsa.pub到远程主机的~/.ssh/下
cat id_dsa.pub >>~/.ssh/authorized_keys
rm id_dsa.pub
chmod 700 ~/.ssh/authorized_keys

不要使用mv 或者是cp 生成authorized_keys文件
因为这样会让你的其它pubkey丢失
authorized_keys可以包括多个pubkey
3.ssh -i id_dsa user@hostname
连接主机
输入key的口令就连接上了

使用SecureCRT
连接ssh 2服务器
SecureCRT生成的key和sshd不兼容,格式有问题
需要转换
Identity.pub为SecureCRT生成的pubkey
转换
ssh-keygen -X -f Identity.pub >Identity.pub2
加入authorized_keys文件
cat Identity.pub2 >>~/.ssh/authorized_keys
rm Identity.pub*
使用SecureCRT就可以连接了
由SecureCRT生成的密钥对和用OpenSSH生成的密钥对在格式上不一样,而且二者都只能认识自己的密钥的格式,所以在用SecureCRT同OpenSSH连接时分别都要用它们自己的密钥格式,可以用任何一个方法生成然后使用ssh-keygen -i 把SecureCRT生成的的密钥转换成OpenSSH的密钥格式,或者用ssh-keygen -e把OpenSSH的密钥格式转换成SecureCRT能够识别的IETF SECSH格式

cygwin->win
所需要的文件列表
cygcrypto-0.9.7.dll
cygminires.dll
cygwin1.dll
cygz.dll
scp.exe
sftp.exe
ssh-add.exe
ssh-agent.exe
ssh-keygen.exe
ssh-keyscan.exe
ssh.exe
ssh_config

SecureCRT 
cygwin_ssh http://tmdnet.3322.org/kid
sftp command
cd path                       Change remote directory to 'path'
切换远程路径
lcd path                      Change local directory to 'path'
切换本地路径
chgrp grp path                Change group of file 'path' to 'grp'
改变属组
chmod mode path               Change permissions of file 'path' to 'mode'
改变权限
chown own path                Change owner of file 'path' to 'own'
改变属主
help                          Display this help text
帮助
get remote-path [local-path]  Download file
下载文件
lls [ls-options [path]]       Display local directory listing
列表本地目录
ln oldpath newpath            Symlink remote file
建立连接
lmkdir path                   Create local directory
建立本地目录
lpwd                          Print local working directory
显示本地工作目录
ls [path]                     Display remote directory listing
列表远程目录
lumask umask                  Set local umask to 'umask'
设置本地 umask
mkdir path                    Create remote directory
建立远程目录
progress                      Toggle display of progress meter
关闭显示进度条
put local-path [remote-path]  Upload file
上传文件
pwd                           Display remote working directory
显示远程工作目录
exit                          Quit sftp
退出sftp环境
quit                          Quit sftp
退出sftp环境
rename oldpath newpath        Rename remote file
重命名远程文件
rmdir path                    Remove remote directory
删除远程目录
rm path                       Delete remote file
删除远程文件
symlink oldpath newpath       Symlink remote file
建立连接
version                       Show SFTP version
查看版本
!command                      Execute 'command' in local shell
执行本地shell命令
!                             Escape to local shell
进入本地shell环境
?                             Synonym for help
获取帮助
整理
root_119ATmsn.com
2004/09/20


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值