deepin安装vsftpd(仅安装篇)

来源:互联网 发布:type3软件下载 编辑:程序博客网 时间:2024/06/08 16:55

前言:如果你想在你的Linux/Unix服务器上搭建一个安全、高性能、稳定性好的FTP服务器,那么vsftpd可能是你的首选应用。vsftpd意思为“very secure FTP daemon(非常安全的FTP进程)”,是一个基于GPL发布的类UNIX类操作系统上运行的服务器的名字(是一种守护进程),可以运行在诸如Linux、BSD、Solaris、HP-UX以及Irix等系统上面。vsftpd支持很多其他传统的FTP服务器不支持的良好特性。(其实我只是复制粘贴的)



其他linux挺正常的,但在deepin就挂了,hh

于是乎常规方法行不通,我就去试试源码包里面的步骤,额,成功了

这里不用源码包里面的,不过我贴出源码包里面的INSTALL里面的内容,在最底部(上面主要讲安装)

1、创建一个vsftp的默认用户nobody

效果如下:

[root@localhost root]# useradd nobody
useradd:用户“nobody”已存在


2、创建文件夹(记住在root用户下执行全部命令)

命令如下:

mkdir /srv/ftp

mkdir /srv/ftp/download

mkdir /srv/ftp/upload


mkdir /usr/local/man/man8

mkdir /usr/local/man/man5


mkdir /usr/share/empty/

mkdir /var/ftp/

更改权限:

chmod 777 /srv/ftp/upload

chmod 755 /srv/ftp/download


chown root.root /var/ftp

chmod og-w /var/ftp


3、安装vsftpd

通过命令:apt-get install vsftpd

安装好了,下一步运行命令添加一个配置信息

echo 'listen=YES' >> /etc/vsftpd.conf

不添加的话,会提示说ipv4绑定不了什么


4、启动-关闭服务

普通方式:service vsftpd start|stop|restart(这个在deepin完全失效了,呵呵呵)

源码包里面的方式:/usr/local/sbin/vsftpd &(呵呵,成功了,但是你竟然不给出关闭服务的命令,只给了开启的)

这是我找的关闭的方式:killall vsftp(看命令就感觉好暴力啊)

无意间找到一个成功的命令耶,神了(这就是ubuntu上面差不多的提示效果,我是小白,别喷)

/etc/init.d/vsftpd start|stop|restart


5、检验是否能用

其中ftp命令deepin并没有提供,所以apt-get install ftp(这个你懂的),ftp是linux下的一个ftp客户端

本地登陆:ftp localhost

Connected to localhost.
220 (vsFTPd 3.0.3)
Name (localhost:hui): ftp --写个ftp就行了
331 Please specify the password.
Password:--好像是当前用户密码,第一次用,我也是猜猜而已
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 Jul 17 05:56 download
drwxr-xr-x    2 0        0            4096 Jul 17 05:57 upload
226 Directory send OK.
ftp> 

进到这里怎么也能说能用吧,退出ftp直接输入bye


能用了,但还要配置啊,额,第一次配置略懵逼

6、vsftpd配置文件配置

这个请期待下一篇文章,写得太长不好啊,这里写得好长了










----------------------------------------------------------------------我是最底部,呵呵了--------------------------------------------------------------------------

INSTALL
=======


This file details how to build and install / run vsftpd from the vsftpd
distribution .tar.gz file.


Step 1) Build vsftpd.


Switch to the directory created when you unpacked the vsftpd .tar.gz file.
e.g.:


cd vsftpd-1.1.2


edit "builddefs.h" to handle compile-time settings (tcp_wrappers build,
etc).


Just type "make" (and mail me to fix it if it doesn't build ;-).
This should produce you a vsftpd binary. You can test for this, e.g.:


[chris@localhost vsftpd]$ ls -l vsftpd
-rwxrwxr-x    1 chris    chris       61748 Sep 27 00:26 vsftpd


Step 2) Satisfy vsftpd pre-requisites
2a) vsftpd needs the user "nobody" in the default configuration. Add this
user in case it does not already exist. e.g.:


[root@localhost root]# useradd nobody
useradd: user nobody exists


2b) vsftpd needs the (empty) directory /usr/share/empty in the default
configuration. Add this directory in case it does not already exist. e.g.:


[root@localhost root]# mkdir /usr/share/empty/
mkdir: cannot create directory `/usr/share/empty': File exists


2c) For anonymous FTP, you will need the user "ftp" to exist, and have a
valid home directory (which is NOT owned or writable by the user "ftp").
The following commands could be used to set up the user "ftp" if you do not
have one:


[root@localhost root]# mkdir /var/ftp/
[root@localhost root]# useradd -d /var/ftp ftp


(the next two are useful to run even if the user "ftp" already exists).
[root@localhost root]# chown root.root /var/ftp
[root@localhost root]# chmod og-w /var/ftp


Step 3) Install vsftpd config file, executable, man page, etc.


Running "make install" will try to copy the binary, man pages, etc. to
somewhere sensible.
Or you might want to copy these things by hand, e.g.:
cp vsftpd /usr/local/sbin/vsftpd
cp vsftpd.conf.5 /usr/local/man/man5
cp vsftpd.8 /usr/local/man/man8


"make install" doesn't copy the sample config file. It is recommended you
do this:
cp vsftpd.conf /etc


Step 4) Smoke test (without an inetd).


vsftpd can run standalone or via an inetd (such as inetd or xinetd). You will
typically get more control running vsftpd from an inetd. But first we will run
it without, so we can check things are going well so far.
Edit /etc/vsftpd.conf, and add this line at the bottom:


listen=YES


This tells vsftpd it will NOT be running from inetd.
Right, now let's try and run it!
Log in as root.
Make sure you are not running other FTP servers (or vsftpd will not be able
to use the FTP port, 21).
Run the binary from wherever you put it, e.g.:


[root@localhost root]# /usr/local/sbin/vsftpd &
[1] 2104


If all is well, you can now connect! e.g.:


[chris@localhost chris]$ ftp localhost
Connected to localhost (127.0.0.1).
220 (vsFTPd 1.1.1)
Name (localhost:chris): ftp
331 Please specify the password.
Password:
230 Login successful. Have fun.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,229,133)
150 Here comes the directory listing.
d--x--x--x    2 0        0            4096 Jan 14  2002 bin
d--x--x--x    2 0        0            4096 Apr 21 20:52 etc
drwxr-xr-x    2 0        0            4096 Apr 21 20:52 lib
drwxr-sr-x    2 0        50           4096 Jul 26 22:58 pub
226 Directory send OK.
ftp>


Step 5) Run from an inetd of some kind (optional - standalone mode is now
recommended)


You may want to run the binary from an inetd of some kind, because this can
give you extra features - e.g. xinetd has a lot of settings. (Note that
vsftpd's inbuilt listener covers most of the more useful xinetd settings).


5a) If using standard "inetd", you will need to edit /etc/inetd.conf, and add
a line such as:


ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/vsftpd


(Make sure to remove or comment out any existing ftp service lines. If you
don't have tcp_wrappers installed, or don't want to use them, take out the
/usr/sbin/tcpd part).


inetd will need to be told to reload its config file:
kill -SIGHUP `pidof inetd`


5b) If using "xinetd", you can follow a provided example, by looking at the
file EXAMPLE/INTERNET_SITE/README. Various other examples show how to leverage
the more powerful xinetd features.




Step 6) Set up PAM for local logins (optional)


If you are running vsftpd on a PAM enabled machine, you will need to have a
/etc/pam.d/ftp file present, otherwise non-anonymous logins will fail. [NOTE -
if you have an older version of PAM, that file might be /etc/pam.conf]


For a standard setup, you can just copy a provided example file:
cp RedHat/vsftpd.pam /etc/pam.d/ftp




Step 7) Customize your configuration


As well as the above three pre-requisites, you are recommended to install a
config file. The default location for the config file is /etc/vsftpd.conf.
There is a sample vsftpd.conf in the distribution tarball. You probably want
to copy that to /etc/vsftpd.conf as a basis for modification, i.e.:


cp vsftpd.conf /etc


The default configuration allows neither local user logins nor anonymous
uploads. You may wish to change these defaults.


Other notes
===========


Tested platforms (well, it builds)
- Any modern, well featured platform should work fine! Recent versions of
the platforms listed below, and often older ones, should work fine.
- Fedora Core
- RedHat Linux
- RedHat Enterprise Linux
- Solaris / GNU tools (Solaris 8 or newer)
- SuSE Linux
- Debian Linux
- OpenBSD
- FreeBSD
- NetBSD
- HP-UX / GNU tools
- IRIX / GNU tools
- AIX / GNU tools
- Mac OS X (note; older versions have setgroups() problem. 10.3.4 reported OK)

0 0
原创粉丝点击