redhat安装openssh和配置sftp锁定目录_Linux服务器维护_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

redhat安装openssh和配置sftp锁定目录

作者:黑客防线网安redhat教程网 来源:黑客防线网安redhat教程网 浏览次数:0

本篇关键词:redhatopenssh
黑客防线网安网讯:操作系统:
[root@station28 ~]# cat /etc/issue.net
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel 
 on an \m
[root@station28 ~]# uname -a
Linux station28.example.com 2.6.18-164.el5 #1

[root@station28 ~]# service sshd restart //提示报错,只要touch该文件即可规避
Stopping sshd:                                             [  OK  ]
lstat(/etc/ssh/ssh_host_ecdsa_key.pub) failed: No such file or directory
Starting sshd:                                             [  OK  ]
[root@station28 ~]# touch /etc/ssh/ssh_host_ecdsa_key.pub
[root@station28 ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@station28 ~]# ssh -V //安装成功
OpenSSH_6.1p1, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

以下步骤为搭建sftp步骤
[root@station28 ssh]# mkdir /home/sftpserver
[root@station28 ssh]# useradd -d /home/sftpserver -s /bin/false test01 //创建用户,指定shell为/bin/false
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
[root@station28 ssh]# passwd test01
Changing password for user test01.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@station28 ssh]# pwd
/etc/ssh
[root@station28 ssh]# cp sshd_config  sshd_config_1114.bak
sshd_config配置如下
# Authentication: //在Authentication下加入如下两行,指定可以登入的网段
AllowUsers *@192.168.*.*
AllowUsers *@127.0.0.1
# override default of no subsystems
#Subsystem      sftp    /usr/local/ssh/libexec/sftp-server //将这行注释,使用internal-sftp,添加如下行
Subsystem       sftp    internal-sftp

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server
//在最下面添加如下行,对test01这个用户chroot到/home/sftpserver目录下
Match User test01
        X11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp
        ChrootDirectory /home/sftpserver
[root@station28 ssh]# sftp test01@192.168.14.28//chroot成功
test01@192.168.14.28'spassword:
Connected to 192.168.14.28.
sftp> pwd
Remote working directory: /

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-19614-1.html
网站维护教程更新时间:2013-01-14 22:12:08  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer