学习笔记Linux (二) —— ftp服务

首先给虚拟机分给IP地址 关闭防火墙等操作使主机和虚拟机之间可以通信

在D盘中输入“ftp://虚拟机IP地址” 找到pub文件夹

下面进行一系列操作使得可以将主机上的文件上传到pub文件夹中 

1.现复制一份,以防自己更改错误无法找回

 cp /etc/vsftpd/vsftpd.conf /test

2.进入vsftpd.conf

[root@localhost /]# vi /etc/vsftpd/vsftpd.conf

3.输入“:set nu”后进行如下图修改,修改完成按 esc “:wq”保存退出

4.运行vsftpd 不报错证明修改成功

 systemctl restart vsftpd

5.修改ftp权限 

由图可以看到没有写的功能,chmod 777 pub 后,有写的功能

[root@localhost /]# cd /var/ftp
[root@localhost ftp]# ls -l
总用量 0
drwxr-xr-x. 2 root root 6 10月 14 2020 pub
[root@localhost ftp]# chmod 777 pub
[root@localhost ftp]# ls -l
总用量 0
drwxrwxrwx. 2 root root 6 10月 14 2020 pub
v

6.此时还是不能把文件拖拽到pub文件夹中,执行强命令

# setenforce 0

7.此时可以把文件成果拖拽到pub文件夹中 ,查看用户登录次数和操作

[root@localhost log]# ls xferlog 
xferlog
[root@localhost log]# vi xferlog 
[root@localhost log]# vi xferlog 
[root@localhost log]# vi xferlog 
[root@localhost log]# cd /var/log/httpd
[root@localhost httpd]# pwd
/var/log/httpd
[root@localhost httpd]# ls
access_log  access_log-20220425  error_log  error_log-20220425

[root@localhost httpd]# more access_log-20220425 

二、把ftp服务和网页服务连在一起 

1.新建一个word文档,保存为html格式,移入到pub中

2.输入指令,可以看到begin.html在html文件夹下 

[root@localhost html]# cp /var/ftp/pub/begin.html  /var/www/html
[root@localhost html]# ls
begin.html  hello.html  index.html
[root@localhost html]# cp /var/ftp/pub/begin.html  /var/www/html
[root@localhost html]# ls
begin.html  hello.html  index.html
[root@localhost html]# cd /var/www/html
[root@localhost html]# chmod 777 begin.html
[root@localhost html]# ls
begin.html  hello.html  index.html
[root@localhost html]# cd /var/log/
[root@localhost log]# ls
anaconda           dmesg.old           messages           speech-dispatcher     vmware-network.5.log      wpa_supplicant.log
audit              firewalld           messages-20220425  spooler               vmware-network.6.log      wtmp
boot.log           gdm                 pluto              spooler-20220425      vmware-network.7.log      xferlog
boot.log-20220425  glusterfs           ppp                swtpm                 vmware-network.8.log      Xorg.0.log
btmp               grubby_prune_debug  qemu-ga            tallylog              vmware-network.9.log      Xorg.0.log.old
chrony             httpd               rhsm               tuned                 vmware-network.log        Xorg.1.log
cron               lastlog             sa                 vmware-network.1.log  vmware-vgauthsvc.log.0    Xorg.2.log
cron-20220425      libvirt             samba              vmware-network.2.log  vmware-vmsvc-root.log     Xorg.9.log
cups               maillog             secure             vmware-network.3.log  vmware-vmtoolsd-root.log  yum.log
dmesg              maillog-20220425    secure-20220425    vmware-network.4.log  vmware-vmusr-root.log
[root@localhost log]# cd httpd
[root@localhost httpd]# ls
access_log  access_log-20220425  error_log  error_log-20220425
[root@localhost httpd]# cd access_log-20220425
bash: cd: access_log-20220425: 不是目录

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值