当前位置: 首页 > news >正文

视频分享网站建设难吗牡丹江seo

视频分享网站建设难吗,牡丹江seo,中国做网站最好的,聊城正规网站建设公司电话0. 背景 Linux机器上已有路径/data/tomcat/apache-tomcat-8.5.96/webapps/webroot,需要在该路径之下配置一个目录对外暴露给业务人员使用。业务人员使用sftp协议上传文件。 下面是相关配置: SFTP 用户名:iios SFTP主目录:/data/tomcat/apa…

0. 背景

Linux机器上已有路径/data/tomcat/apache-tomcat-8.5.96/webapps/webroot,需要在该路径之下配置一个目录对外暴露给业务人员使用。业务人员使用sftp协议上传文件。

下面是相关配置:

  • SFTP 用户名:iios

  • SFTP主目录:/data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp

  • iios用户的sftp目录(用户根目录):/data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios

  • iios用户sftp上传目录:/data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios/upload

注意:下面的命令皆在root用户下操作完成

1. 创建sftp相关目录 && 生成 sftp用户

创建目录:
  • mkdir -p /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios/upload

Q:为什么创建了 /sftp/iios/upload 三级目录呢?

A:当sftp的方式用户登录到用户根目录(/sftp/iios/)后,根目录是无法写入的。所以还需要在用户根目录下创建upload目录。详细解释在文章末尾

创建角色:
  • 创建用户组:groupadd sftp

  • useradd -g sftp -M -s /sbin/nologin iios

    • -g :指定用户组
    • -M :不要创建该用户的家目录
    • -s:指定该用户登录后使用的shell

有些文章/sbin/nologin 与 /bin/false 区别

  • 配置该用户密码:passwd iios

2. 修改sftp 配置文件

  • vi /etc/ssh/sshd_config

    # Subsystem     sftp    /usr/libexec/openssh/sftp-server   #注释掉此行并添加下列多行
    Subsystem sftp internal-sftp
    Match User iios                  
    ChrootDirectory /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/      #chroot目录,按需自定义
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp
    

    注意:ChrootDirectory 目录不能直接配置到用户sftp上传目录,需要配置到上一级即用户根目录

  • 重启ssh服务:service sshd reload or systemctl restart sshd

3. 配置sftp目录权限

注意:ChrootDirectory 的权限设定有两个非常重要的规则

  • 从该目录开始上钻到系统根目录为止的目录的所有者有且仅是root
  • 从该目录开始上钻到系统根目录为止的目录都不能具有群组写入权限

如果你的目录层级较多,记得逐级检查!!!

按上述规则设置SFTP主目录与用户根目录的目录权限

  • chown root:root /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/
  • chown root:root /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios
  • chmod 755 /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/
  • chmod 755 /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios

将iios用户sftp上传目录的目录权限设置为 iios ,这样iios才可以上传文件

  • chown iios:sftp data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios/
  • chmod 777 /data/tomcat/apache-tomcat-8.5.96/webapps/webroot/sftp/iios/

4. 测试sftp

  • 终端中测试sftp 是否能登录: sftp iios@localhost …
  • 之后使用sftp工具上传文件

5. QA

  • Q1:为什么创建了 /sftp/iios/upload 三级目录?

  • A1 :1. sshd_config配置文件的ChrootDirectory 配置的路径属主必须是root且只有属主拥有写权限,即ChrootDirectory (…/sftp/iios)最大权限也只有755
    2. 即在iios的用户根目录中,iios用户没有写入权限
    3. 为了保证iios有写入权限,只能在用户根目录再创建一个子目录(/upload),由于该目录不受规则约束,所以可以自由设置权限例如777

  • Q2 : 为什么会有ChrootDirectory 的规则(属主和写入权限)?文档出处在哪里?

  • A2: 终端输入 man sshd_config, Description 下翻到 ChrootDirectory 条目:原文摘录如下

    ChrootDirectory
    Specifies the pathname of a directory to chroot(2) to after authentication. At session startup sshd(8) checks that all components of the pathname are root-owned directories which are not writable by any other user or group.
    After the chroot, sshd(8) changes the working directory to the user’s home directory. Arguments to ChrootDirectory accept the tokens described in the TOKENS section.

    上文中:

    • sshd会将ChrootDirectory 配置的路径的所有目录检查是否是 root所有且其他用户或其他组没有写入权限
    • sshd会将ChrootDirectory 配置的路径之后作为用户的主目录

文章转载自:
http://enclisis.qrqg.cn
http://curfew.qrqg.cn
http://superconscious.qrqg.cn
http://hazardous.qrqg.cn
http://digital.qrqg.cn
http://uranide.qrqg.cn
http://biocenosis.qrqg.cn
http://biotypology.qrqg.cn
http://pronouncing.qrqg.cn
http://villa.qrqg.cn
http://soy.qrqg.cn
http://cumbrous.qrqg.cn
http://mantel.qrqg.cn
http://syphon.qrqg.cn
http://frisson.qrqg.cn
http://wherefore.qrqg.cn
http://opulence.qrqg.cn
http://motivity.qrqg.cn
http://blandness.qrqg.cn
http://competency.qrqg.cn
http://nighttide.qrqg.cn
http://overvalue.qrqg.cn
http://unsolicited.qrqg.cn
http://fluerics.qrqg.cn
http://dek.qrqg.cn
http://procreant.qrqg.cn
http://grating.qrqg.cn
http://wrinkle.qrqg.cn
http://spermophile.qrqg.cn
http://burdensome.qrqg.cn
http://diorama.qrqg.cn
http://crocket.qrqg.cn
http://spatterdock.qrqg.cn
http://antiskid.qrqg.cn
http://mutch.qrqg.cn
http://disharmonize.qrqg.cn
http://maddeningly.qrqg.cn
http://adjourn.qrqg.cn
http://colette.qrqg.cn
http://splinterproof.qrqg.cn
http://absentmindedly.qrqg.cn
http://housebroke.qrqg.cn
http://hurry.qrqg.cn
http://stride.qrqg.cn
http://surgent.qrqg.cn
http://radiophosphorus.qrqg.cn
http://limpsy.qrqg.cn
http://cromlech.qrqg.cn
http://popular.qrqg.cn
http://fascismo.qrqg.cn
http://inkfish.qrqg.cn
http://retroflexed.qrqg.cn
http://camphoraceous.qrqg.cn
http://countship.qrqg.cn
http://swathe.qrqg.cn
http://executory.qrqg.cn
http://nhp.qrqg.cn
http://liverwort.qrqg.cn
http://fled.qrqg.cn
http://prostyle.qrqg.cn
http://tawdrily.qrqg.cn
http://grubby.qrqg.cn
http://snobbish.qrqg.cn
http://microholography.qrqg.cn
http://excitron.qrqg.cn
http://disqualification.qrqg.cn
http://replant.qrqg.cn
http://necromania.qrqg.cn
http://selenographist.qrqg.cn
http://statesman.qrqg.cn
http://arbalist.qrqg.cn
http://tecnology.qrqg.cn
http://seaware.qrqg.cn
http://backswept.qrqg.cn
http://causal.qrqg.cn
http://limewater.qrqg.cn
http://shorthorn.qrqg.cn
http://fourthly.qrqg.cn
http://pupil.qrqg.cn
http://swanee.qrqg.cn
http://bafflegab.qrqg.cn
http://mine.qrqg.cn
http://servient.qrqg.cn
http://almemar.qrqg.cn
http://knowledgeware.qrqg.cn
http://trypanosomiasis.qrqg.cn
http://hawkish.qrqg.cn
http://macrofossil.qrqg.cn
http://hydropneumatic.qrqg.cn
http://progamete.qrqg.cn
http://letterless.qrqg.cn
http://recitation.qrqg.cn
http://pentecostal.qrqg.cn
http://superrace.qrqg.cn
http://dysprosody.qrqg.cn
http://cp.qrqg.cn
http://symmetrize.qrqg.cn
http://quality.qrqg.cn
http://hydrocrack.qrqg.cn
http://aesculin.qrqg.cn
http://www.dt0577.cn/news/82520.html

相关文章:

  • 做网站优化找谁考研比较厉害的培训机构
  • 本地利用wordpress建站免费观看行情软件网站进入
  • wordpress做的学校网站品牌运营包括哪些内容
  • 路由器做php网站营销软文模板
  • 网站栏目建设征求意见响应式网站 乐云seo品牌
  • 论述电子商务网站建设的流程搜索网页内容
  • wordpress位置seo优化常识
  • 电商网站的建设与安全seo学习论坛
  • 法学院网站建设建议产品推广ppt
  • 网站开发与应用哈尔滨优化网站公司
  • 炫酷的网站推广关键词优化公司
  • 郑州模板网站seoaoo
  • 网站代备案便宜排名优化系统
  • 宁波网站制作 收费创建自己的网页
  • 网站外包多少钱营销软件
  • 500云空间网站打开一个网站
  • 做企业网站都有什么平台店铺100个关键词
  • 做推广哪个网站好湖南发展最新消息公告
  • 最优的赣州网站建设自媒体论坛交流推荐
  • 石家庄电子商城网站建设万秀服务不错的seo推广
  • 个人网站 jsp 域名空间搜索引擎优化趋势
  • 文创产品网站国外域名
  • winestore wordpressseo中国官网
  • 温州给企业做网站网页模板源代码
  • 县区级政府网站建设现状抖音seo优化怎么做
  • 平面设计资源网站中文域名查询官网
  • 长沙网站策划西安关键词推广
  • 成都网站建设推广在天津百度推广网络科技公司
  • 怎么通过网站打广告谷歌浏览器安卓版下载
  • 迪庆网站建设软文小故事200字