当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 1 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [原创]Ubuntu 10.4 AMD64电脑vsFTPd安装方法与中文显示乱码解决办法
帖子发表于 : 2011-05-18 10:06 

注册: 2010-05-10 13:40
帖子: 19
送出感谢: 0 次
接收感谢: 0 次
#1. install vsftpd
#2. install fuse
#3.install fuse-convmvfs
#4. enjoy as a server


void vsftpd()

{
The latest vsftpd release is v2.3.4, currently at ftp://vsftpd.beasts.org/users/cevans/
#here the compressed file is put in ~/ or $HOME or /home/username
#unzip file
代码:
tar -xvzf vsftpd-2.3.4.tar.gz

#grip root previlage
代码:
sudo su

#go to vsftpd directory
代码:
cd vsftpd-2.3.4

#make procedure begins here, basically you can just follow INSTALL file in the dir
代码:
make
useradd nobody
mkdir /usr/share/empty/
mkdir /var/ftp/
useradd -d /var/ftp ftp
chown root.root /var/ftp
chmod og-w /var/ftp

#make ends here and make install begins
代码:
cp vsftpd /usr/local/sbin/vsftpd
cp vsftpd.conf.5 /usr/local/man/man5
cp vsftpd.8 /usr/local/man/man8

#after make install copy vsftpd.conf to /etc, this is an example configuration file
代码:
cp vsftpd.conf /etc

#Edit /etc/vsftpd.conf, and add this line at the bottom: listen=YES
代码:
gedit /etc/vsftpd.conf

#now run vsftpd, in later cases you may need to use command: sudo /usr/local/sbin/vsftpd
代码:
/usr/local/sbin/vsftpd

#type ps -a and you will see vsftpd running
代码:
ps -a
#PID TTY          TIME CMD
#12715 pts/6    00:00:00 vsftpd

#
#you can connect to your server if no error occurs, try this command: ftp localhost
代码:
ftp localhost
#Connected to localhost.
#220 (vsFTPd 2.3.4)
#Name (localhost:username): anonymous
#331 Please specify the password.
#Password:(you can just type Enter without entering a 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.
#.....<list of files on the server> (not shown here in detail)


## 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.
#For a standard setup, you can just copy a provided example file:
代码:
cp RedHat/vsftpd.pam /etc/pam.d/ftp

#now you may wish to chage the default configuration file to customize it to your needs.
代码:
gedit /etc/vsftpd.conf

}

void fuse()
{
FUSE stands for Filesystem in Userspace, homepage: http://fuse.sourceforge.net/
you can download it from sourceforge: http://sourceforge.net/projects/fuse/files/fuse-2.X/
I used fuse-2.7.0 here, it will be ok if the version is not too old, I guess, so be free to choose whichever version you wish to use.

#installation begins here, refer to INSTALL file in fuse-2.7.0 dir
代码:
  tar -xvzf fuse-2.7.0.tar.gz
  cd fuse-2.7.0/
  ./configure
  make
  make install

#use sudo make instal if necessary
代码:
modprobe fuse

#util now, installation of fuse is complete. I expect you are not likely to encounter any problems.
}

void fuse-convmvfs()
{
fuse-convmvfs is a userland file system to convert filename charset.
visite its homepage if you would like to learn more about it: http://fuse-convmvfs.sourceforge.net/ download it from sourceforge: http://sourceforge.net/projects/fuse-convmvfs/files/
I used version fuse-convmvfs-0.2.6 here.

#installation begins here, refer to INSTALL file in fuse-convmvfs-0.2.6 dir
代码:
  tar -xvzf fuse-convmvfs-0.2.6.tar.gz
  cd fuse-convmvfs-0.2.6/
  ./configure
  make
  make install

#use sudo make instal if necessary
#util now, installation of fuse is complete. maybe you will use convmvfs --help to test your installation.
代码:
convmvfs --help


#the output maybe like this:

代码:
usage: convmvfs mountpoint [options]

general options:
    -o opt,[opt...]        mount options
    -h   --help            print help
    -V   --version         print version

FUSE options:
    -d   -o debug          enable debug output (implies -f)
    -f                     foreground operation
    -s                     disable multi-threaded operation
    .....................................

}

void enjoy()
{
since you have installed all the needed software, now you can set up the proper display of chinese characters in your ftp's clients' GUI.

the strategy here is to use fuse-convmvfs to create a GBK misrror for the UTF8 source directory you provided on your own server machine.

viste http://blog.pluskid.org/?p=344 or follow me here.

#the details comes below:
#assume the root directory of your ftp is /var/ftp, resource is located in /var/ftp/pub
#obviously files in /pub will be displayed in a UTF8 way, but in some cases GBK display could be necessary, e.g. ftp clients working under MS-OS.
#so first you shall make sure there exists a mirror directory /var/ftp/pub_gbk for you source directory, e.g. /var/ftp/pub. now you can provide a BI-ENCODING ftp server to cater the need of MS-OS users.


#create a mirror directory displayed in GBK encoding.

代码:
sudo convmvfs /var/ftp/pub_gbk -o srcdir=/var/ftp/pub -o icharset=utf8 -o ocharset=gbk  -o nonempty -o allow_other -o uid=0
 

#then run vsftpd

代码:
  sudo /usr/local/sbin/vsftpd



#to stop the mirror use the umount command below:

代码:
sudo fusermount -u /var/ftp/pub_gbk

}

Running setup:
代码:
sudo /usr/local/sbin/vsftpd #开启服务
sudo convmvfs /var/ftp/pub_gbk -o srcdir=/var/ftp/pub -o icharset=utf8 -o ocharset=gbk -o nonempty -o allow_other -o uid=0 -o gid=11 #建立GBK编码镜像

sudo fusermount -u /var/ftp/pub_gbk #用于结束编码镜像


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 1 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译