Ubuntu下ftp服务器

    技术2022-05-20  29

    <!-- /* Font Definitions */ @font-face {font-family:Arial; panose-1:2 11 6 4 2 2 2 2 2 4; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-536859905 -1073711037 9 0 511 0;} @font-face {font-family:Times; panose-1:2 0 5 0 0 0 0 0 0 0; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:"MS 明朝"; mso-font-charset:78; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-536870145 1791491579 18 0 131231 0;} @font-face {font-family:宋体; mso-font-alt:宋体; mso-font-charset:80; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:新細明體; mso-font-charset:81; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 22 0 1048577 0;} @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-1593833729 1073750107 16 0 415 0;} @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-1593833729 1073750107 16 0 415 0;} @font-face {font-family:Cambria; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-536870145 1073743103 0 0 415 0;} @font-face {font-family:mceinline; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:auto; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:"Adobe 明體 Std L"; mso-font-charset:81; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 437197056 22 0 1179653 0;} @font-face {font-family:"Heiti TC Light"; panose-1:2 0 0 0 0 0 0 0 0 0; mso-font-charset:81; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-2147483601 134742090 16 0 1048576 0;} @font-face {font-family:"ヒラギノ明朝 ProN W6"; mso-font-charset:78; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-536870145 2059927551 18 0 131085 0;} @font-face {font-family:"小塚ゴシック Pr6N EL"; mso-font-charset:78; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:727 717691921 18 0 131231 0;} @font-face {font-family:"小塚ゴシック Pro H"; mso-font-charset:78; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:131 717691921 18 0 131077 0;} @font-face {font-family:"小塚明朝 Pro R"; mso-font-charset:78; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:131 717691921 18 0 131077 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} p {mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:10.0pt; font-family:Times; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-family:Cambria; mso-ascii-font-family:Cambria; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS 明朝"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Cambria; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} @page WordSection1 {size:595.0pt 842.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.WordSection1 {page:WordSection1;} /* List Definitions */ @list l0 {mso-list-id:277299763; mso-list-type:hybrid; mso-list-template-ids:-1119819698 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level2 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level3 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; text-indent:-9.0pt;} @list l0:level4 {mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level5 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level6 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; text-indent:-9.0pt;} @list l0:level7 {mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level8 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l0:level9 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; text-indent:-9.0pt;} @list l1 {mso-list-id:1834683998; mso-list-type:hybrid; mso-list-template-ids:1405890400 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l1:level1 {mso-level-text:"%1/)"; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:54.0pt; text-indent:-18.0pt;} @list l1:level2 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:90.0pt; text-indent:-18.0pt;} @list l1:level3 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; margin-left:126.0pt; text-indent:-9.0pt;} @list l1:level4 {mso-level-tab-stop:none; mso-level-number-position:left; margin-left:162.0pt; text-indent:-18.0pt;} @list l1:level5 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:198.0pt; text-indent:-18.0pt;} @list l1:level6 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; margin-left:234.0pt; text-indent:-9.0pt;} @list l1:level7 {mso-level-tab-stop:none; mso-level-number-position:left; margin-left:270.0pt; text-indent:-18.0pt;} @list l1:level8 {mso-level-number-format:alpha-lower; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:306.0pt; text-indent:-18.0pt;} @list l1:level9 {mso-level-number-format:roman-lower; mso-level-tab-stop:none; mso-level-number-position:right; margin-left:342.0pt; text-indent:-9.0pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

    介绍一款Very Secure FTP daemon(VSFTPD)

    1.   安装 $sudo apt-get install vsftpd

    2.   启动 $sudo /etc/init.d/vsftpd start 关闭 $sudo /etc/init.d/vsfptd stop 重启 $sudo /etc/init.d/vsftpd restart

    3.   配置 (配置文件在/etc/vsftpd.conf)

    1)   匿名服务器的连接(星号的属于FTP的基本选项) #Anonymous_enable=yes (允许匿名登陆,默认不允许) Dirmessage_enable=yes (切换目录时,显示目录下.message的内容) Local_umask=022 (FTP上本地的文件权限,默认是077) Connect_form_port_20=yes (启用FTP数据端口的数据连接)* Xferlog_enable=yes (激活上传和下传的日志) Xferlog_std_format=yes (使用标准的日志格式) Ftpd_banner=XXXXX (欢迎信息) Pam_service_name=vsftpd (验证方式)* Listen=yes (独立的VSFTPD服务器)*

    2)   开启匿名FTP服务器上传权限 在配置文件中添加以下的信息即可: Anon_upload_enable=yes (开放上传权限) Anon_mkdir_write_enable=yes (可创建目录的同时可以在此目录中上传文件) Write_enable=yes (开放本地用户写的权限) Anon_other_write_enable=yes (匿名帐号可以有删除的权限)

    3)   开启匿名服务器下传的权限 (R)读-----下传 (W)写----上传 (X)执行---- 如果不开FTP的目录都进不去

    4)   普通用户FTP服务器的连接(独立服务器) 在配置文件中添加如下信息即可: Local_enble=yes (本地帐户能够登陆) Write_enable=no (本地帐户登陆后无权删除和修改文件) 功能:可以用本地帐户登陆vsftpd服务器,有下载上传的权限 注:在禁止匿名登陆的信息后匿名服务器照样可以登陆但不可以上传下传

    5)   用户登陆限制进其它的目录,只能进它的主目录 设置所有的本地用户都执行chroot Chroot_local_user=yes (本地所有帐户都只能在自家目录) 设置指定用户执行chroot Chroot_list_enable=yes (文件中的名单可以调用) Chroot_list_file=/etc/vsftpd.chroot_list

    6)   限制本地用户访问FTP Userlist_enable=yes (用userlistlai 来限制用户访问) Userlist_deny=no (名单中的人不允许访问) Userlist_file=/指定文件存放的路径/ (文件放置的路径) 注:开启userlist_enable=yes匿名帐号不能登陆

    7)   安全选项 Idle_session_timeout=600(秒) (用户会话空闲后10分钟) Data_connection_timeout=120(秒) (将数据连接空闲2分钟断) Accept_timeout=60(秒) (将客户端空闲1分钟后断) Connect_timeout=60(秒) (中断1分钟后又重新连接) Local_max_rate=50000(bite) (本地用户传输率50K) Anon_max_rate=30000(bite) (匿名用户传输率30K) Pasv_min_port=50000 (将客户端的数据连接端口改在 Pasv_max_port=60000 50000—60000之间) Max_clients=200 (FTP的最大连接数) Max_per_ip=4 (每IP的最大连接数) Listen_port=5555 (从5555端口进行数据连接)

    8)   更改用户的根目录,默认的根目录是此时登陆ftp用户的家目录,在文件最后一行加入 ,user_config_dir=/etc/local_root 新建/etc/vsftpd.chroot_list 文件,列出所要限制用户浏览文件的用户名

    输入

    joan1

    joan2

    新建用户

    sudo useradd -m joan1

    sudo passwd joan1

     

    新建文件夹 ,以确定ftp用户所在的根目录

    mkdir /etc/local_root

    新建以用户名命名的文件,(这里有两个用户,所以重复两次操作)

    vi /etc/local_root/joan1

    输入local_root=/home/joan1/www

    vi /etc/local_root/joan2

    输入local_root=/home/joan2/www

    修改文件夹的权限,使拥有修改权限

    chmod 777 /home/joan1/www

    chmod 777 /home/joan2/www

     


    最新回复(0)