ssh配置与管理
时间:2009-03-23 来源:sjhf
一,下载SSH
•SSH的版本: 1.2.27 和 2.0.13 •ftp://ftp.zixia.net/Linux/Security/SSH/Linux/ssh-1.2.27.tar.gz •ftp://ftp.zixia.net/Linux/Security/SSH/Linux/ssh-2.0.13.tar.gz •ftp://ftp.zixia.net/Linux/Security/SSH/WinClient/scrt30.exe (破解文件在同一目录下) 二,安装ssh •Tar zxf ssh-1.2.27.tar.gz •Cd ssh-1.2.27 •./configure #缺省安装在 /usr/local/bin & /usr/local/sbin 下面 •Make && make install •这样就将 ssh1 安装到你的系统中了 三,ssh1 所安装的文件 •常用的: •/usr/local/sbin/sshd1 # 服务器端的支持SecureShell的Server,类似Telnetd •/usr/local/bin/ssh1 # 客户端用来登陆SecureShell Server用的,类似telnet • /usr/local/bin/scp1 #使用SSHD来在不同机器间拷贝文件的程序 四,配置SSH •在启动的时候启动sshd1 •Ssh1的配置文件:/etc/ssh_config Sshd1的配置文件:/etc/sshd_config #长的这个样子: Port 22 ListenAddress 0.0.0.0 HostKey /etc/ssh_host_key RandomSeed /etc/ssh_random_seed ServerKeyBits 768 LoginGraceTime 600 KeyRegenerationInterval 3600 PermitRootLogin yes 五,几个/etc/sshd_config选项 •Port 22 #sshd监听的端口号 •ListenAddress 0.0.0.0 #sshd监听的ip •PermitRootLogin yes #是否允许root使用ssh登陆 •IgnoreRhosts no #是否忽略用户个人的.rhosts •AllowHosts *.zixia.net #允许登陆的主机 •DenyHosts aka.org.cn #不允许登陆的主机 SSH2安装与配置 一,安装SSH •Tar zxf ssh-2.0.13.tar.gz •Cd ssh-2.0.13 •./configure #缺省安装在 /usr/local/bin & /usr/local/sbin 下面 •Make && make install •这样就将 ssh2 安装到你的系统中了 •注意:和安装ssh1完全一样,也和几乎所有的软件包安装方法一样J 二,SSH的几个安装文件 •常用的: •/usr/local/sbin/sshd2 # 服务器端的支持SecureShell的Server,类似Telnetd •/usr/local/bin/ssh2 # 客户端用来登陆SecureShell Server用的,类似telnet • /usr/local/bin/scp2 #使用SSHD2来在不同机器间拷贝文件的程序 •/usr/local/bin/sftp-server2 #安全的ftp服务器,类似ftpd •/usr/local/bin/sftp #安全的ftp客户端,类似ftp 三,配置SSHD2 •在启动的时候启动sshd1 •Ssh1的配置文件:/etc/ssh2/ssh2_config •Sshd1的配置文件:/etc/ssh2/sshd2_config #长的这个样子: Port 22 ListenAddress 0.0.0.0 Ciphers AnyStd # Ciphers AnyCipher # Ciphers AnyStdCipher # Ciphers 3des 四,启动时运行sshd2 •修改 /etc/rc.d/rc.local •在最尾部加入如下行: # # Start sshd2 /usr/local/sbin/sshd2 & •也可以在/etc/rc.d/init.d下增加sshd的启动脚本,然后在/etc/rcN.d下建立相应的链接 五,几个/etc/ssh2/sshd2_config选项 •Port 22 #监听端口 •ListenAddress 0.0.0.0 #监听IP •PasswordGuesses 3 #密码输入错误次数 •MaxConnections 0 #最多有多少连接,0为不限制 •PermitRootLogin yes #是否允许root登陆 •Ssh1Compatibility yes #是否兼容 ssh1 •# Sshd1Path /usr/local/sbin/sshd1 •# AllowHosts localhost, foobar.com, friendly.org •# DenyHosts evil.org, aol.com •subsystem-sftp sftp-server •命令行参数: ssh –l user host [-v] -l 指定以哪个用户的身份登陆 host 以ssh登陆的主机 -p 指定ssh登陆端口,缺省22 -v 输出连接过程中的详细信息 •例子: ssh –l zixia zixia.net –p22 ssh [email protected] •命令行参数: scp src user@host:filename -P port –v src 本地文件 user 用来登陆的远程主机用户名 host 远程主机名 filename 以用来登陆的用户的HOME为缺 省目录的相对(或绝对文件路径) -P 大写的“p” 指定端口号,缺省22 -v 输出一些连接信息 SSH系列:sftp2-server/sftp2 sftp:安全文件传输(Secure ftp) 传输过程中数据为加密形式 Sftp2-server:相当于ftpd Sftp2:相当于ftp Sftp2-server /etc/ssh2/sshd2_config: 这行:subsystem-sftp sftp-server 启动ssh2后自然就可以使用sftp2登录。 |
相关阅读 更多 +