Starting vsftpd for vsftpd: OK ] 3.2.2. 更换port 提供服务:将预设的port 21 更换为2121 为了安全,或是以port 来区隔不同的ftp 服务,我们可能会将ftp port 改为21 之外的port,那么,可参考以下步骤。 Step1. 修改/etc/vsftpd/vsftpd.conf 新增底下一行 listen_port=2121 Step2. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ] 3.2.3. 特定使用者peter、john 不得变更目录 使用者的预设目录为/home/username,若是我们不希望使用者在ftp 时能够切换到上一层目录/home,则可参考以下步骤。 Step1. 修改/etc/vsftpd/vsftpd.conf 将底下三行 #chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list 改为 chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list Step2. 新增一个档案: /etc/vsftpd/chroot_list 内容增加两行: peter
john Step3. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ] 若是peter 欲切换到根目录以外的目录,则会出现以下警告: ftp> cd /home
550 Failed to change directory. 3.2.4. 取消anonymous 登入 若是读者的主机不希望使用者匿名登入,则可参考以下步骤。 Step1. 修改/etc/vsftpd/vsftpd.conf 将 anonymous_enable=YES 改为 anonymous_enable=NO Step2. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ] 3.2.5. 安排欢迎话语 若是我们希望使用者在登入时,能够看到欢迎话语,可能包括对该主机的说明,或是目录的介绍,可参考以下步骤。 首先确定在/etc/vsftpd/vsftpd.conf 当中是否有底下这一行 dirmessage_enable=YES RedHat9 的默认值是有上面这行的。 接着,在各目录之中,新增名为.message 的档案,再这边假设有一个使用者test1,且此使用者的根目录下有个目录名为abc,那首先我们在/home/test1之下新增.message,内容如下: Hello~ Welcome to the home directory
This is for test only... 接着,在/home/test1/abc 的目录下新增.message,内容如下: Welcome to abcs directory
This is subdir... 那么,当使用者test1 登入时,会看到以下讯息: 230- Hello~ Welcome to the home directory
230-
230- This is for test only...
230- 若是切换到abc 的目录,则会出现以下讯息: 250- Welcome to abcs directory
250-
250- This is subdir ... 3.2.6. 对于每一个联机,以独立的process 来运作 一般启动vsftp 时,我们只会看到一个名为vsftpd 的process 在运作,但若是读者希望每一个联机,都能以独立的process 来呈现,则可执行以下步骤。 Step1. 修改/etc/vsftpd/vsftpd.conf 新增底下一行 setproctitle_enable=YES Step2. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ] 使用ps -ef 的指令,可以看告不同使用者联机的情形,如下图所示: [root@home vsftpd]# ps -ef|grep ftp
root 2090 1 0 16:41 pts/0 00:00:00 vsftpd: LISTENER
nobody 2120 2090 0 17:18 ? 00:00:00 vsftpd: 192.168.10.244: connected
test1 2122 2120 0 17:18 ? 00:00:00 vsftpd: 192.168.10.244/test1:IDLE
nobody 2124 2090 0 17:19 ? 00:00:00 vsftpd: 192.168.10.244: connected
test2 2126 2124 0 17:19 ? 00:00:00 vsftpd: 192.168.10.244/test2:IDLE
root 2129 1343 0 17:20 pts/0 00:00:00 grep ftp
[root@home vsftpd]# 3.2.7. 限制传输档案的速度: 本机的使用者最高速度为200KBytes/s,匿名登入者所能使用的最高速度为50KBytes/s。 Step1. 修改/etc/vsftpd/vsftpd.conf 新增底下两行 anon_max_rate=50000
local_max_rate=200000 Step2. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ] 在这边速度的单位为Bytes/s,其中anon_max_rate 所限制的是匿名登入的使用者,而local_max_rate 所限制的是本机的使用者。VSFTPD 对于速度的限制,范围大概在80%到120%之间,也就是我们限制最高速度为100KBytes/s,但实际的速度可能在80KBytes/s 到120KBytes/s 之间,当然,若是频宽不足时,数值会低于此限制。 3.2.8. 针对不同的使用者限制不同的速度:假设test1 所能使用的最高速度为250KBytes/s,test2 所能使用的最高速度为500KBytes/s。 Step1. 修改/etc/vsftpd/vsftpd.conf 新增底下一行 user_config_dir=/etc/vsftpd/userconf Step2. 新增一个目录:/etc/vsftpd/userconf mkdir /etc/vsftpd/userconf Step3. 在/etc/vsftpd/userconf 之下新增一个名为test1 的档案 内容增加一行: local_max_rate=250000 Step4. 在/etc/vsftpd/userconf 之下新增一个名为test2 的档案 内容增加一行: local_max_rate=500000 Step5. 重新启动vsftpd [root@home vsftpd]# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ]
------分隔线----------------------------
- 上一篇:账号管理--使用者功能:chfn, chsh
- 下一篇:各种工具之正则表达式语法比较

百鸣[Baiming.org]欢迎您~