当前位置:首页 » 文件管理 » net2ftplinux

net2ftplinux

发布时间: 2023-03-18 21:35:37

‘壹’ linux环境下,在java中用sun.net.ftp.FtpClient类去读取文件名含有“点号”的文件时报错找不到文件

java对.号解析的问题。linux是对.不敏感的。简单,转义字符,搞定。2011\.9\.9日XX详情.doc

或者
2011\\.9\\.9日XX详情.doc

对java的转义字符不是很了解。上述两种应该有一个可行。

‘贰’ 自己搭建ftp服务器怎么放到linux

vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序。特点是小巧轻快,安全易用。并且是一个完全免费开放源码的ftp软件
方法/步骤
1、用在线安装
yum install vsftpd pam* db4*-y
使用败液宴命令将vsftp配置为系统服务
chkconfig --level 35 vsftpd on
2、配置vsftpd服务的宿主
useradd vsftpdadmin -s /sbin/nologin -M
这个vsftpdadmin只是用来替换root的,并不需要登录
3、建立ftp虚拟宿主帐户
useradd vsftpuser -s /sbin/nologin -M
这ftpuser只个虚拟帐户的宿主,本身是不用登录的
4、配置vsftpd.conf 配置之前要先备份一下原来的
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=YES --> anonymous_enable=NO //不允许匿名用户访问,默认是允许。
chroot_list_enable=YES --> chroot_list_enable=YES //不允许FTP用户离开自己主目录
增加
#设定虚拟用户个人Vsftp的配置文件存放路径。也就是说,这个被指定的目录里,将存放每个Vsftp虚拟用户个性的配置文件,一个需要注意的地方就是这些配置文件名必须和虚拟用户名相同。
user_config_dir=/etc/vsftpd/vconf/userlocal
#这一步非常重要,要记住这一步。一会要根据这个配置新建文件夹

#修改端口号
ftp_data_port=4040
reverse_lookup_enable=NO
pasv_enable=yes
pasv_min_port=48790
pasv_max_port=48800
listen_port=48796 #端口可以根据你自己实际情况配置,也可以用默认端口。但是为埋腊了安全考虑根据自己实际情况配置
5、建立虚拟用户文件
mkdir /etc/vsftpd/vconf
touch /etc/vsftpd/vonf/vir_user
6、建立虚拟用户
vi /etc/vsftpd/vonf/vir_user
virtualuser //用户名
12345678 //密码
7、生成数据库
db_load -T -t hash -f /etc/vsftpd/vconf/vir_user /etc/vsftpd/vconf/vir_user.db
8、设置数据库文件访问权限
chmod 600 /etc/vsftpd/vconf/vir_user
chmod 600 /etc/vsftpd/vconf/vir_user.db
9、修改/etc/pam.d/vsftpd
auth sufficient pam_userdb.so db=/etc/vsftpd/vconf/vir_user
account sufficient pam_userdb.so db=/etc/vsftpd/vconf/vir_user
(要想同时使用系统用户和虚拟用户,就需要把required改成sufficient)
10
根据第四步配置的user_config_dir=/etc/vsftpd/vconf/userlocal
新建userlocal文件夹
mkdir /etc/vsftpd/vconf/userlocal
11、根据第六步建立的用户名建立一个文件
例如第六步建察银立的帐号是virtualuser,则新建一个virtualuser文件
touch /etc/vsftpd/conf/userlocal/virtualuser
12、编辑该用户访问的文件路径
vi /etc/vsftpd/conf/userlocal/virtualuser
输入如下
local_root= //需要指定的网站根目录,例如www..com所在文件夹为/www/
anonymous_enable=NO #禁止匿名用户访问
write_enable=YES #开启写权限
local_umask=022 #上传后文件的权限掩码
anon_upload_enable=NO #关闭匿名下载
anon_mkdir_write_enable=NO #关闭匿名创建文件夹
idle_session_timeout=60 #会话自动关闭时间 60是因分钟
data_connection_timeout=120 #数据延迟时间
max_clients=10 #最大连接数
max_per_ip=5 #同一个ip同时允许5个IP联机
local_max_rate=1048576 #实体用户传输速度限制,单位B/s。0代表不限制
13、配置就此完成,重启vsftpd服务:service vsftpd restart。
查看系统端口状态:netstas -tulnp。如果能看到48796端口正在被vsftpd调用说明启动成功。

‘叁’ linux 里没有ftp服务 怎么安装

Linux中的ftp服务器一般是安装vsftp。以centos为例,具体操作如下:

1、运行yum install vsftpd命令
命令具体的细节如下:
[[email protected]]# yum install vsftpd
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package vsftpd.i386 0:2.0.5-12.el5 set to be updated
filelists.xml.gz 100% |=========================| 648 kB 02:46
http://ftp.hostrino.com/pub/centos/5.2/os/i386/repodata/filelists.xml.gz: [Errno 4] Socket Error: timed out
Trying other mirror.
filelists.xml.gz 100% |=========================| 2.8 MB 00:21
filelists.xml.gz 100% |=========================| 1.1 MB 00:12
filelists.xml.gz 100% |=========================| 132 kB 00:01
filelists.xml.gz 100% |=========================| 150 B 00:00
–> Finished Dependency Resolution

Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
vsftpd i386 2.0.5-12.el5 base 137 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 137 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): vsftpd-2.0.5-12.el 100% |=========================| 137 kB 00:01
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 “CentOS-5 Key (CentOS 5 Official Signing Key) <[email protected]>” from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vsftpd ######################### [1/1]

Installed: vsftpd.i386 0:2.0.5-12.el5
Complete!
[root@localhost ~]#

2、将 /etc/vsftpd/user_list文件和/etc/vsftpd/ftpusers文件中的root这一行注释掉
#root

3、执行以下命令
# setsebool -P ftpd_disable_trans=1
修改/etc/vsftpd/vsftpd.conf,在最后一行处添加local_root=/
4、/sbin/service iptables stop (linux是虚拟机的话要运行这个一句)
5、/sbin/service vsftpd restart

一下是对配置文件中一些参数的说明:
centOS vsftpd建FTP,配置文件有三:
/etc/ftpusers
/etc/vsftpd.user_list
/etc/vsftpd/vsftpd.conf 这个是主配置文件,,

/etc/vsftpd/vsftpd.conf vsftpd.conf 默认配置:

anonymous_enable=YES 允许匿名登录
local_enable=YES 允许本地用户登录
write_enable=YES 开放本地用户写权限
local_umask=022 设置本地用户生成文件的掩码为022
#anon_upload_enable=YES 此项设置允许匿名用户上传文件
#anon_mkdir_write_enable=YES 开启匿名用户的写和创建目录的权限
dirmessage_enable=YES 当切换到目录时,显示该目录下的.message隐藏文件的内容
xferlog_enable=YES 激活上传和下载日志
connect_from_port_20=YES 启用FTP数据端口的连接请求
#chown_uploads=YES 是否具有上传权限. 用户由chown_username参数指定。
#chown_username=whoever 指定拥有上传文件权限的用户。此参数与chown_uploads联用。
#xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES 使用标准的ftpd xferlog日志格式
#idle_session_timeout=600 此设置将在用户会话空闲10分钟后被中断
#data_connection_timeout=120 将在数据连接空闲2分钟后被中断
#ascii_upload_enable=YES 启用上传的ASCII传输方式
#ascii_download_enable=YES 启用下载的ASCII传输方式
#ftpd_banner=Welcome to blah FTP service 设置用户连接服务器后显示消息
#deny_email_enable=NO
此参数默认值为NO。当值为YES时,拒绝使用banned_email_file参数指定文件中所列出的e-mail地址用户登录。
#banned_email_file=/etc/vsftpd.banned_emails 指定包含拒绝的e-mail地址的文件.
#chroot_list_enable=YES 设置本地用户登录后不能切换到自家目录以外的别的目录
#chroot_list_file=/etc/vsftpd.chroot_list
#ls_recurse_enable=YES
pam_service_name=vsftpd
设置PAM认证服务的配置文件名称,该文件存放在/etc/pam.d/
userlist_enable=YES
此项配置/etc/vsftpd.user_list中指定的用户也不能访问服务器,若添加userlist_deny=No,则仅仅/etc /vsftpd.user_list
文件中的用户可以访问,其他用户都不可以访问服务器。如过 userlist_enable=NO,userlist_deny=YES,则指定使文件/etc/vsftpd.user_list中指定的用户不可以访问服务器,其他本地用户可以访问服务器。
listen=YES 指明VSFTPD以独立运行方式启动
tcp_wrappers=YES 在VSFTPD中使用TCP_Wrappers远程访问控制机制,默认值为YES

‘肆’ Linux怎么进行网络安装

Linux网络安装全过程(安装fedora)
先来大概说一下网络安装linux的基本原理。我们是通过PXE(Pre-boot Execution Environment)(其实是intel设计的一个协议)来进行安装的,它可以使计算机通过网络启动。PXE协议分为server和client端,client就是我们即将要装linux的裸机。 linux下网络安装需具备3个条件:
1.dhcp服务器:用于客户端引导时分配IP地址
2.ftp、nfs、httpd服务器:用于保存操作系统的rpm包 3.tftp服务器:用于客户端的tftp引导。 我的方案是DHCP+NFS+TFTP 方案介绍:
这种方案需要首先设置一个启动服务器和一个安装服务器,可以配置在同一台机器上,然后通过网络启动存放在启动服务器上的安装程序。安装程序会自动访问存放在安装服务器上的安装配置文件和安装介质来完成安装。 软硬件需求: · 一台机器作为启动和安装服务器(虚拟机A) · 待安装的机器,它的网卡必须带有PXE支持(虚拟机B) · 一个完好的局域网,机器已经连入同一网。 · 系统镜像文件
配置步骤:
一、DHCP服务器
1、 安装DHCP
[root@localhost ~]# rpm -qa|grep dhcp ;查看是否安装了 dhcp libdhcp6client-1.0.22-1.fc10.i386 libdhcp-1.99.8-1.fc10.i386
dhcp-4.0.0-37.fc10.i386 ;若没有此包,则需用yum install dhcp来安装 libdhcp4client-4.0.0-30.fc10.i386 dhcpv6-client-1.0.22-1.fc10.i386 2、 配置DHCP
DHCP服务的配置文件是/etc/dhcpd.conf,通过修改配置文件进行配置,分两步:一是加入黑体部分,二是修改配置地址。
注:初始安装时/etc/dhcpd.conf配置文件为空,此时可以新建一个直接进行编辑。有个DHCP的配置例子为/usr/share/doc/dhcp-4.0.0/dhcpd.conf.sample。
[root@localhost /]# cd /etc
[root@localhost etc]# vim dhcpd.conf # DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample ddns-update-style interim; ignore client-updates; allow booting; allow bootp;

【必须与本机是同一网段】

subnet 192.168.186.0 netmask 255.255.255.0 {
option routers
192.168.186.135; 【本机地址】
#路由器地址
option subnet-mask
255.255.255.0;
#子网掩码
option domain-name-servers
192.168.186.135;
#DNS地址
option time-offset
-18000; # Eastern Standard Time
range dynamic-bootp 192.168.186.2 192.168.186.100;
filename "/linux-install/pxelinux.0"; #
filename 后面是tftp目录下的文件,用来指定tftp根目录的启动文件。【也可以直接写成
/pxelinux.0,具体由自己设定】
default-lease-time 21600;
#缺省租约时间
max-lease-time 43200;
#最大租约时间
}
[root@localhost ~]# ifconfig eth0 192. 168. 186.135/24

配置地址
[root@localhost etc]# ifconfig ;查本机IP地址。
eth0
Link encap:Ethernet
HWaddr 00:0C:29:26:AC:57
inet addr:192.168.186.135
Bcast:192.168.186.255
Mask:255.255.255.0
注意若要指定给某一特定主机分配地址,需再加入些东西,以下是一个例子

host MyP5 {

filename "pxelinux.0";

server-name "bootserver";

hardware ethernet ae:32:20:00:b0:02;

fixed-address 192.168.187.90;
为客户机(需要安装系统的机器)的 MAC 地址和所分配的IP地址。}

3、开启服务(开启成功则表示配置成功了)

[root@localhost etc]# service dhcpd start
(或者重启restart)

启动dhcpd:[确定]

使用
/etc/init.d/dhcpd start
也可以(在/etc/init.d下即可找到相应的服务service)

二、
NFS服务器

1、安装
NFS
[root@localhost /]# rpm -qa |grep nfs
nfs-utils-lib-1.1.4-1.fc10.i386
nfs-utils-1.1.4-1.fc10.i386
system-config-nfs-1.3.41-1.fc10.noarch

查询是否已安装,否则使用
yum install nfs
进行安装。

2
、配置NFS
[root@localhost /]# mkdir /linuxos
(建立各个版本ISO文件的存放目录,并且将ISO文件拷贝到此目录下,NFS支持iso格式安装。)

[root@localhost /]# mkdir tftpboot
[root@localhost /]# cd tftpboot/

[root@localhost tftpboot]# mkdir linux-install

[root@localhost /]# vim /etc/exports ;配置文件

/mnt *(ro,sync) ;(mnt为NFS的目录,用来存放操作系统。此处选/mnt是因为

其是挂载光盘的挂载点)
/tftpboot/linux-install *(ro,sync) 3、启动NFS
[root@localhost tftpboot]# exportfs –a ;使用此命令使配置生效 [root@localhost /]# service nfs start(或restart)
启动 NFS 服务: [确定] 关掉 NFS 配额: [确定] 启动 NFS 守护进程: [确定] 启动 NFS mountd: [确定]
三、TFTP服务器
1、安装TFTP
[root@localhost /]# rpm -qa |grep tftp
tftp-0.49-1.fc10.i386 ;这个只是tftp客户端软件
tftp-server-0.49-1.fc10.i386 ;这个才是tftp服务器软件(必不可少) 若没有则需使用yum下载。 [root@localhost /]# yum install tftp
[root@localhost /]# yum install tftp-server 2、配置TFTP
[root@localhost init.d]# vim /etc/xinetd.d/tftp ;配置文件 service tftp {
disable = no
socket_type = dgram protocol = udp wait = yes user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot ;将 /tftpboot 定义为 tftp 服务的默认目录,您可以自行修改。 per_source = 11 cps = 100 2 flags = IPv4 }
3、保存之后重启 /etc/init.d/xinetd 服务,即可开启 tftp 服务。(注意此服务service不识别)
[root@localhost /]# /etc/init.d/xinetd restart
停止 xinetd: [确定] 启动 xinetd:
[确定] 4、 测试tftp (1)下载文件

‘伍’ linux ftp下如何get多个目录的文件

1、查看是否安装vsftpd,如果没有用yum安装,本系统没有安装。

‘陆’ 我的linux里没有ftp命令.怎么安装

Linux中的ftp服务器一般是安装vsftp。以centos为例,具体操作如下: 1、运行yum install vsftpd命令 命令具体的细节如下: [[email protected]]# yum install vsftpd Setting up Install Process Parsing package install arguments Resolving Dep...

‘柒’ java中在linux环境下,运用org.apache.commons.net.ftp.FTPClient包,下载FTP服务上的文件,报出异常:

1,确保手工用FTP客户端连接没问题。
2,手工没问题,程序也应该没问题才是。
3,确保程序中安全CLOSE连接,FTP服务器也是有连接限制的。
4,适当考虑重起一下FTP服务器。

‘捌’ 急求两台linux机器间的文件传输方法

可以使用scp命令。
具体方法:
scp 本地用户名@IP地址:文件名 1 远程用户名 @IP 地址 : 文件名 2
[ 本地用户名 @IP 地址:] 可以不输入 , 可能需要输入远程用户名所对应的密码 。

可能有用的几个参数 :
-v 和大多数 linux 命令中的 -v 意思一样 , 用来显示进度 . 可以用来查看连接 , 认证 , 或是配置错误 .
-C 使能压缩选项 .
-P 选择端口 . 注意 -p 已经被 rcp 使用 .
-4 强行使用 IPV4 地址 .
-6 强行使用 IPV6 地址 .
-r Recursively entire directories.
如——
本地的档案到远程的机器上
scp /etc/lilo.conf
会将本地的 /etc/lilo.conf 这个档案 到使用者my 的家目录下。

举例:
本地的档案到远程的机器上
scp /etc/lilo.conf
会将本地的 /etc/lilo.conf 这个档案 到 net67使用者 k 的家目录下。
远程机器上的档案到本地来
scp .etc/lilo.conf /etc
会将 中 /etc/lilo.conf 档案 到本地的 /etc 目录下。
保持从来源 host 档案的属性
scp –p k@net67.:/etc/lilo.conf /etc
在此必须注意使用者的权限是否可读取远程上的档案,若想知道更多关于 scp 的使用方法,可去看看 scp 的使用手册。

‘玖’ linux只安装vsftpd就能使用ftp命令

linux不需要安装vxftpd也可以使用ftp命令(FTP客户端)。

在大多发行版都有打包,请到各大发行版的ftp列表中得到,或者在发行版的安装盘中也能得到。lftp是一个命令行式的ftp客户端。对中文支持较好。如果您在linux 的text模式下,要安装zhcon或者cce之类的。

安装:

1、RPM包管理的系统,请到

http://freshrpms.net
http;//rpmfind.net 上查找lftp的最新包,可以用

#rpm -ivh name.rpm
#rpm -Uvh name.rpm 这是升级之用

2、源码包安装举例:lftp-3.2.0.tar.bz2

#tar zxvf lftp-3.2.0.tar.bz2
#cd lftp-3.2.0
#./configure
#make
#make install

3.调用方法:

lftp ftp://用户名:密码@地址

比如:
[beinan@S01~]$lftp ftp://[email protected]
口令:
lftp [email protected]:~>
lftp [email protected]:~>ls

-rw-r--r-- 1 1000 100 44387 May 18 10:04 xvmain.jpg
-rw-r--r-- 1 1000 100 202643 May 18 09:45 xxx.jpeg
-rw-r--r-- 1 1000 100 0 May 20 10:01 鲨鱼的故事.txt

二、使用方法:

0.简单的用法:lcd 切换本地目录,比如 lcd /opt
get 取回一个文件,put 向ftp服务器传文件;

1、获得帮助:

代码:

lftp [email protected]:~> help
!<shell-command>(commands)
alias [<name> [<value>]]anon
bookmark [SUBCMD] cache [SUBCMD]
cat [-b] <files>cd <rdir>
chmod [OPTS] mode file... close [-a]
[re]cls [opts] [path/][pattern] debug [<level>|off] [-o <file>]
[options] <dirs> exit [<code>|bg]
get [OPTS] <rfile> [-o <lfile>] glob [OPTS] <cmd> <args>
help [<cmd>]history -w file|-r file|-c|-l [cnt]
jobs [-v] kill all|<job_no>
lcd <ldir>lftp [OPTS] <site>
ls [<args>] mget [OPTS] <files>
mirror [OPTS] [remote [local]]mkdir [-p] <dirs>
mole name [args]more <files>
mput [OPTS] <files> mrm <files>
mv <file1> <file2>[re]nlist [<args>]
open [OPTS] <site>pget [OPTS] <rfile> [-o <lfile>]
put [OPTS] <lfile> [-o <rfile>] pwd [-p]
queue [OPTS] [<cmd>]quote <cmd>
repeat [delay] [command]rm [-r] [-f] <files>
rmdir [-f] <dirs> scache [<session_no>]
set [OPT] [<var> [<val>]] site <site_cmd>
source <file> user <user|URL> [<pass>]
version wait [<jobno>]
zcat <files>zmore <files>

如果针对lftp的每个命令的帮助,应该是:

lftp [email protected]:~> help 命令

比如

代码:
lftp [email protected]:~> help get

用法: get [OPTS] <rfile> [-o <lfile>]

Retrieve remote file <rfile> and store it to local file <lfile>.
-o <lfile> specifies local file name (default - basename of rfile)
-ccontinue, reget
-Edelete remote files after successful transfer
-ause ascii mode (binary is the default)
-O <base> specifies base directory or URL where files should be placed

简介:gftp基于gtk的ftp客户端,大家用的也比较多吧,支持中文目录。如果您的gftp不能支持中文,请升级版本。

# Written in C and has a text interface and a GTK+ 1.2/2.x interface
# Supports the FTP, FTPS (control connection only), HTTP, HTTPS, SSH and FSP protocols
# FTP and HTTP proxy server support
# Supports FXP file transfers (transferring files between 2 remote servers via FTP)
# Supports UNIX, EPLF, Novell, MacOS, VMS, MVS and NT (DOS) style directory listings
# Bookmarks menu to allow you to quickly connect to remote sites

下载安装:

在各大发行版中,都有gftp的打包,可以用各发行版自带的工具来安装。我只说源码包安装:

源码包安装,通用于所有发行版,举例说明:gftp-2.0.18.tar.bz2

代码:
[root@S01ftp]#ls -lh

总用量 1.4M

-rw-r--r--1 root root 1.4M 2005-05-21 09:18 gftp-2.0.18.tar.bz2
[root@S01ftp]#tar jxvf gftp-2.0.18.tar.bz2
[[email protected]]#./configure
[[email protected]]#make
[[email protected]]#make install

注:因为gftp依赖gtk,如果不能make过去,您应该指定PKG_CONFIG_PATH

[[email protected]]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

调用:

代码:

[[email protected]]#gftp

热点内容
佳能相机存储卡错误 发布:2025-05-17 19:00:59 浏览:888
云访问安全 发布:2025-05-17 18:36:31 浏览:625
算法设计与分析课件 发布:2025-05-17 18:21:11 浏览:766
安卓禁止软件安装怎么解除 发布:2025-05-17 18:16:52 浏览:219
绝地求生极客电脑怎么配置 发布:2025-05-17 18:16:50 浏览:51
显卡编程语言 发布:2025-05-17 18:11:46 浏览:919
编程用什么轴机械键盘 发布:2025-05-17 18:10:35 浏览:960
金融工程编程 发布:2025-05-17 18:10:33 浏览:224
私密模式访问 发布:2025-05-17 18:09:44 浏览:788
数据库崩溃原因 发布:2025-05-17 18:09:42 浏览:307