[原创]Ubuntu 10.4 AMD64电脑vsFTPd安装方法与中文显示乱码解决办法

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
nathand
帖子: 19
注册时间: 2010-05-10 13:40
送出感谢: 0
接收感谢: 0

[原创]Ubuntu 10.4 AMD64电脑vsFTPd安装方法与中文显示乱码解决办法

#1

帖子 nathand » 2011-05-18 10:06

#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 #用于结束编码镜像
回复

回到 “服务器基础应用”