中国青基会
RSS
热门关键字:  None  linux+moodle安装  mac  rhel5  199
当前位置 : Nixsky>BSD>OpenBSD>列表

使用OpenBSD自带的ftpd程序搭建ftp服务器

来源:cnfug.org 作者:张煌彬 时间:2007-03-04 点击:

  2、允许匿名用户登录访问FTP资源

  因为匿名用户登录到FTP服务器后,实际上是以\ftp"用户的身份进行所有操作,所以出于安全考虑,这个用户的权限通常被设置得很低。比如:

  ·不为该用户提供一个可用的shell,使其无法登录系统;

  ·没有一个可用的密码(即FAQ上说的"This account shouldn't have a usable password;");

  ·登录系统后被chroot;

  ·......

  设置用于匿名访问FTP资源的'ftp'帐户

  接下来我们要做的就是按照上面列出的三个要求来添加和设置这个低权限、处处受限的"ftp"用户。

  1、添加"ftp"帐户以提供匿名访问

  在/etc/shells中添加一个无法实际使用的shell设置"ftp"使用这个shell的目的,是不允许它通过shell登录到系统中。通常我们会有两种选择:

  ·/sbin/nologin

  ·/usr/bin/false

  为了在添加用户时可以使用这两个shell,我们可以这样做:

  # echo '/sbin/nologin' >> /etc/shells

  # echo '/usr/bin/false' >> /etc/shells

  或者在未将它们加入到/etc/shells的情况下,在使用adduser添加帐户时加上"-shell"参数:

  # adduser -shell /sbin/nologin

  Enter username []: ftp

  Enter full name []: anonymous ftpd user

  Enter shell bash csh ksh nologin sh [/sbin/nologin]:

  ......

  这里在询问该用户使用何种shell时就出现了/sbin/nologin 。如果不带这个参

  数,将无法使用它:

  # adduser

  Enter username []: ftp

  Enter full name []: anonymous ftpd user

  Enter shell bash csh ksh nologin sh [bash]: /sbin/nologin

  /sbin/nologin: is not allowed!

  Enter shell bash csh ksh nologin sh [bash]:

  这里就提示了不允许使用/sbin/nologin 做为shell使用。

  添加帐户

  这里使用"adduser -s shell /sbin/nologin"来添加一个这样的'ftp'帐户做为示例,并将该用户的$HOME目录设置为"/var/ftp":

  # adduser -shell /sbin/nologin -home /var

  Use option \-silent" if you don't want to see all warnings and questions.

  Reading /etc/shells

  Check /etc/master.passwd

  Check /etc/group

  Ok, let's go.

  Don't worry about mistakes. I will give you the chance later to correct any input.

  Enter username []: ftp

  Enter full name []: anonymous ftpd user

  Enter shell bash csh ksh nologin sh [/sbin/nologin]:ENTER

  Uid [1001]:ENTER

  Login group ftp [ftp]:ENTER

  Login group is \ftp". Invite ftp into other groups: guest no

  no

  : ENTER

  Login class daemon default sta. [default]:ENTER

  Enter password []: ENTER # 在此直接按ENTER键。

上一篇:没有了
下一篇:OpenBSD3.8+PF+PFSYNC+CARP
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册