知识大全 建立 Anonymous FTP Server
Posted 资料
篇首语:热水治不了百病,情话过不了一生。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 建立 Anonymous FTP Server相关的知识,希望对你有一定的参考价值。
建立 Anonymous FTP Server 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
加入以下资料在 /etc/passwd 这个例子选择 /export/ftp 作为 anonymous ftp area 设定为不能看见 Shell 的内容 /nosuchshell ftp:x: : :Anonymous FTP:/export/ftp:/nosuchshell 加入以下资料在 /etc/shadow ftp:NP: :::::: 以下shell script用来设定anonymous ftp area 把以下内容放入 /etc/ftpanonymous #!/bin/sh # script to setup anonymous ftp area # # verify you are root /usr/bin/id | grep w uid= >/dev/null >& if [ $? != ]; then echo exit fi # handle the optional mand line argument case $# in # the default location for the anon ftp es from the passwd file ) ftphome= `getent passwd ftp | cut d: f ` ;; ) if [ $ = start ]; then ftphome= `getent passwd ftp | cut d: f ` else ftphome=$ fi ;; *) echo Usage: $ [anon ftp root] exit ;; esac if [ z $ftphome ]; then echo $ : ftphome must be non null exit fi case $ftphome in /*) # ok ;; *) echo $ : ftphome must be an absolute pathname exit ;; esac # This script assumes that ftphome is neither / nor /usr so if [ z $ftphome o $ftphome = / o $ftphome = /usr ]; then echo $ : ftphome must be non null and neither / or /usr exit fi # If ftphome does not exist but parent does create ftphome if [ ! d $ftphome ]; then # lack of p below is intentional mkdir $ftphome fi chown root $ftphome chmod $ftphome echo Setting up anonymous ftp area $ftphome # Ensure that the /usr directory exists if [ ! d $ftphome/usr ]; then mkdir p $ftphome/usr fi # Now set the ownership and modes to match the man page chown root $ftphome/usr chmod $ftphome/usr # Ensure that the /usr/bin directory exists if [ ! d $ftphome/usr/bin ]; then mkdir p $ftphome/usr/bin fi # Now set the ownership and modes to match the man page chown root $ftphome/usr/bin chmod $ftphome/usr/bin # this may not be the right thing to do # but we need the bin > usr/bin link rm f $ftphome/bin ln s usr/bin $ftphome/bin # Ensure that the /usr/lib and /etc directories exist if [ ! d $ftphome/usr/lib ]; then mkdir p $ftphome/usr/lib fi chown root $ftphome/usr/lib chmod $ftphome/usr/lib if [ ! d $ftphome/usr/lib/security ]; then mkdir p $ftphome/usr/lib/security fi chown root $ftphome/usr/lib/security chmod $ftphome/usr/lib/security if [ ! d $ftphome/etc ]; then mkdir p $ftphome/etc fi chown root $ftphome/etc chmod $ftphome/etc # a list of all the mands that should be copied to $ftphome/usr/bin # /usr/bin/ls is needed at a minimum ftpcmd= /usr/bin/ls # $ftphome/usr/lib needs to have all the libraries needed by the above # mands plus the runtime linker and some name service libraries # to resolve names We just take all of them here ftplib= `ldd $ftpcmd | nawk $ ~ /lib/ print $ | sort | uniq` ftplib= $ftplib /usr/lib/nss_* /usr/lib/straddr* /usr/lib/libmp so* ftplib= $ftplib /usr/lib/libnsl so /usr/lib/libsocket so /usr/lib/ld so ftplib= `echo $ftplib | tr \\n | sort | uniq` cp $ftplib $ftphome/usr/lib chmod $ftphome/usr/lib/* cp /usr/lib/security/* $ftphome/usr/lib/security chmod $ftphome/usr/lib/security/* cp $ftpcmd $ftphome/usr/bin chmod $ftphome/usr/bin/* # you also might want to have separate minimal versions of passwd and group cp /etc/passwd /etc/group /etc/netconfig /etc/nf $ftphome/etc chmod $ftphome/etc/* # need /etc/default/init for timezone to be correct if [ ! d $ftphome/etc/default ]; then mkdir $ftphome/etc/default fi chown root $ftphome/etc/default chmod $ftphome/etc/default cp /etc/default/init $ftphome/etc/default chmod $ftphome/etc/default/init # Copy timezone database mkdir p $ftphome/usr/share/lib/zoneinfo (cd $ftphome/usr/share/lib/zoneinfo (cd /usr/share/lib/zoneinfo; find print | cpio o) >/dev/null | cpio imdu >/dev/null find print | xargs chmod find print | xargs chown root ) # Ensure that the /dev directory exists if [ ! d $ftphome/dev ]; then mkdir p $ftphome/dev fi # make device nodes ticotsord and udp are necessary for # ls to resolve NIS names for device in zero tcp udp ticotsord ticlts do line=`ls lL /dev/$device | sed e s/ // ` major=`echo $line | awk print $ ` minor=`echo $line | awk print $ ` rm f $ftphome/dev/$device mknod $ftphome/dev/$device c $major $minor done chmod $ftphome/dev/* ## Now set the ownership and modes chown root $ftphome/dev chmod $ftphome/dev # unment the below if you want a place for people to store things # but beware the security implications #if [ ! d $ftphome/pub ]; then # mkdir p $ftphome/pub #fi #chown root $ftphome/pub #chmod $ftphome/pub # chmod /etc/ftpanonymous # /etc/ftpanonymous ( 执行ftpanonymous ) # cd ~ftp/etc < 检查有没有不能公开的文档 完成 cha138/Article/program/Java/Javascript/201311/25428相关参考
在Linux下建立FTP搜索引擎 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 摘要:parke
知识大全 windows2000server的主要功能及特点有哪些
windows2000server的主要功能及特点有哪些、FTP、DNS、DHCP、E-MAIL、VPN等等WindowsServer2003R2的额外新功能-分支办事处伺服器管理--文件和印表机集中
SQLServer数据对象结构的动态建立 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! Micr
如何使用MSCS建立SQLServer集群 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 集群是
如何建立安全的MSSQLServer的启动账号 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! S
知识大全 SQL Server 建立连接时出现与网络相关的错误
SQLServer建立连接时出现与网络相关的错误 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
知识大全 当我正在为表建立索引的时候,SQL Server 会禁止对表的访问吗
当我正在为表建立索引的时候,SQLServer会禁止对表的访问吗? 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一
SSH进阶(二):FTP转发 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 简介 FTP协议简
C#FTP操作类 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 最近要做个用ftp读取文件并在浏
对JAVA的两个FTP包进行比较分析 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! ftp*;