redhat安裝openssh和配置sftp鎖定目錄_Linux服務器維護_龍虎鷹師網安服務器維護基地--Powered by www.vqbhynr.com.cn

redhat安裝openssh和配置sftp鎖定目錄

作者:龍虎鷹師網安redhat教程網 來源:龍虎鷹師網安redhat教程網 瀏覽次數:0

本篇關鍵詞:redhatopenssh
龍虎鷹師網安網訊:操作系統:
[[email protected] ~]# cat /etc/issue.net
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel 
 on an \m
[[email protected] ~]# uname -a
Linux station28.example.com 2.6.18-164.el5 #1

操作系統:
[[email protected] ~]# cat /etc/issue.net
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel on an \m
[[email protected] ~]# uname -a
Linux station28.example.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

在配置sftp時需要chroot特定的目錄則openssh的版本需不低于5.1,我這下載的是openssh 6.1版本的源碼包,需要進行編譯,
則需要安裝gcc,同時需要安裝openssl-devel-0.9.8e-12.el5
openssh-6.1p1下載地址:或者進入官網下載
ftp://ftp.openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz
若不安裝openssl-devel,則報如下錯誤:
[[email protected] openssh-6.1p1]#./configure --prefix=/usr/local/ssh --sysconfdir=/etc/ssh  --with-zlib --with-ssl-dir=/usr/local/ssl--with-md5-passwords --mandir=/usr/share/man
checking for openssl/opensslv.h... no
configure: error: *** OpenSSL headers missing - please install first or check config.log ***

1、配置yum,安裝gcc,openssl-devel-0.9.8e-12.el5,和telnet(當ssh不能用的時候,用于連接服務器
[[email protected] ~]# cat /etc/yum.repos.d/base.repo
[base]
baseurl=file:///mnt/Server
gpgcheck=0
[[email protected] ~]# yum -y install "gcc*"
[[email protected] ~]# yum -y install "openssl-devel-0.9.8e-12.el5"
[[email protected] openssh-6.1p1]# yum -y install "telnet-server*"

卸載openssh,觀察openssh的各個包包含的內容:
[[email protected] ~]# cd /etc/ssh
[[email protected] ssh]# mkdir /root/1114_ssh_bak
[[email protected] ssh]# cp * /root/1114_ssh_bak/
[[email protected] ssh]# rpm -qa | grep openssh //目前系統安裝的是4.3版本的
openssh-server-4.3p2-36.el5
openssh-askpass-4.3p2-36.el5
openssh-4.3p2-36.el5
openssh-clients-4.3p2-36.el5
[[email protected] ~]# ssh -V
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
[[email protected] ssh]# rpm -ql openssh-server-4.3p2-36.el5 //查看安裝包涉及的內容
/etc/pam.d/sshd
/etc/rc.d/init.d/sshd
/etc/ssh
/etc/ssh/sshd_config
/usr/libexec/openssh/sftp-server
/usr/sbin/.sshd.hmac
/usr/sbin/sshd
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz
/var/empty/sshd
/var/empty/sshd/etc
/var/empty/sshd/etc/localtime
[[email protected] ssh]# rpm -ql openssh-askpass-4.3p2-36.el5
/etc/profile.d/gnome-ssh-askpass.csh
/etc/profile.d/gnome-ssh-askpass.sh
/usr/libexec/openssh/gnome-ssh-askpass
/usr/libexec/openssh/ssh-askpass
[[email protected] ssh]# rpm -ql openssh-4.3p2-36.el5
/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
.....
....
[[email protected] ssh]# rpm -ql openssh-clients-4.3p2-36.el5
/etc/ssh/ssh_config
/usr/bin/.ssh.hmac
/usr/bin/scp
/usr/bin/sftp
/usr/bin/slogin
/usr/bin/ssh
/usr/bin/ssh-add
/usr/bin/ssh-agent
/usr/bin/ssh-copy-id
/usr/bin/ssh-keyscan
......
.....
[[email protected] ssh]# rpm -qa | grep openssh //全部卸載
openssh-server-4.3p2-36.el5
openssh-askpass-4.3p2-36.el5
openssh-4.3p2-36.el5
openssh-clients-4.3p2-36.el5
[[email protected] ssh]# rpm -e openssh-server-4.3p2-36.el5
[[email protected] ssh]# rpm -e openssh-askpass-4.3p2-36.el5
[[email protected] ssh]# rpm -e openssh-4.3p2-36.el5 //存在依賴關系,需要先卸載openssh-clients-4.3p2-36.el5.x86_64
error: Failed dependencies:
        openssh = 4.3p2-36.el5 is needed by (installed) openssh-clients-4.3p2-36.el5.x86_64
[[email protected] ssh]# rpm -e openssh-clients-4.3p2-36.el5
[[email protected] ssh]# rpm -e openssh-4.3p2-36.el5
[[email protected] ssh]# rpm -qa | grep openssh //全部卸載干凈

[[email protected] ~]# pwd
/root
[[email protected] ~]# ls openssh-6.1p1.tar.gz
openssh-6.1p1.tar.gz
[[email protected] ~]# tar -zxpf openssh-6.1p1.tar.gz //解壓openssh 6.1
[[email protected] ~]# cd openssh-6.1p1 //執行以下命令進行編譯
[[email protected] openssh-6.1p1]# ./configure --prefix=/usr/local/ssh --sysconfdir=/etc/ssh  --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man
[[email protected] openssh-6.1p1]# make
[[email protected] openssh-6.1p1]# make install //warn的報錯忽略
[[email protected] openssh-6.1p1]# cd /usr/local/ssh/bin //剛用--frefix參數指定的路徑/usr/local/ssh,將其bin下的拷貝到/usr/bin下
[[email protected] bin]# ls
scp  sftp  slogin  ssh  ssh-add  ssh-agent  ssh-keygen  ssh-keyscan
[[email protected] bin]# cp * /usr/bin/
[[email protected] bin]# cd /usr/local/ssh/sbin
[[email protected] sbin]# ls
sshd
[[email protected] sbin]# cp sshd /usr/sbin/sshd //同理
[[email protected] sbin]# cd /root/openssh-6.1p1/contrib/redhat/ //將sshd.init拷貝到/etc/init.d/下,名字為sshd(ssh的daemon名稱)
[[email protected] redhat]# ls
gnome-ssh-askpass.csh  gnome-ssh-askpass.sh  openssh.spec  sshd.init  sshd.init.old  sshd.pam  sshd.pam.old
[[email protected] redhat]# cp sshd.init /etc/init.d/sshd
[[email protected] redhat]# ls -l /etc/init.d/sshd
-rwxr-xr-x 1 root root 1768 Nov 14 23:21 /etc/init.d/sshd
[[email protected] redhat]# chkconfig --add sshd
[[email protected] redhat]# service sshd restart

    龍虎鷹師網安服務器維護方案本篇連接:http://www.vqbhynr.com.cn/show-19614-1.html
網站維護教程更新時間:2013-01-14 22:12:08  【打印此頁】  【關閉
全站連接N點 | 龍虎鷹師網安 |  
專業服務器維護及網站維護手工安全搭建環境,網站安全加固服務。龍虎鷹師網安服務器維護基地招商進行中!請QQ:29769479

footer  footer  互聯網安全  footer    

山东体十一选五走势 趣盈期货 赤井美月番号 保定哪期货配资做得好 天星麻将下载 打麻将规则打法视频 查询每天3D试机号 长春按摩休闲会所 3d试机号和开机号 五粮液股票行情查询 好好热综合久久东京热 上证指数走势图十年 湖人vs山猫 湖北快三 98年公牛vs爵士国语 极速快3 东京热一本道是什么