您的位置:首页 > 编程语言 > PHP开发

ftp地址映射mount到本地

2012-07-02 13:03 225 查看
浅析vsftpd服务器安装配置和将ftp地址mount映射到本地的方法

1.安装ftp 服务器daemon程序

luther@gliethttp:~$ sudo apt-get install vsftpd

luther@gliethttp:~$ sudo mkdir -p /home/ftp_dir/upload

luther@gliethttp:~$ sudo chown ftp:ftp /home/ftp_dir/upload 供匿名用户使用的根目录

2.打开ftp服务器配置文件中anonymous匿名用户访问许可,同时追加匿名用户登录目录.

luther@gliethttp:~$ sudo vim /etc/vsftpd.conf

anonymous_enable=YES

anon_root=/home/ftp_dir

# 这样当ftp://localhost时将显示/home/ftp_dir目录中的内容,它将作为upload,download的基础目录

3. 重启ftp服务器使得修改后的/etc/vsftpd.conf配置参数生效

luther@gliethttp:~$ sudo service vsftpd restart

4.这样可以使用ftp://localhost 登录ftp服务器了

5.如果希望匿名用户可以上传文件和创建文件夹,那么需要打开如下参数

luther@gliethttp:~$ sudo vim /etc/vsftpd.conf

write_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES

# 允许匿名用户读取自己创建的目录里面的内容

anon_world_readable_only=NO

# 允许删除,重命名等操作

anon_other_write_enable=YES

luther@gliethttp:~$ sudo service vsftpd restart

那如何将ftp和smbfs一样作为文件mount到本地机呢,下面我们来看看具体实现:

1.安装curlftpfs文件系统

luther@gliethttp:~$ sudo apt-get install curlftpfs

或者

luther@gliethttp:~$ wget http://ftp.us.debian.org/debian/pool/main/c/curlftpfs/curlftpfs_0.9.1-3+b2_i386.deb
2.mount 指定ftp到本地文件中

luther@gliethttp:~$ sudo curlftpfs -o rw,allow_other ftp://172.16.32.123 /home/ubuntu/ftp

这样目录/home/ubuntu/ftp下就是firefox中 ftp://172.16.32.123浏览到的内容了
3.卸载mount到的ftp目录和卸载普通mount一样,直接sudo umount /home/ubuntu/ftp即可

( 注:

. ftp://172.16.32.123等效于ftp://anonymous@172.16.32.123
. curlftpfs标准命令如下所示:

curlftpfs ftp://username:password@192.168.1.111 /mnt/ftp

)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: