tomcat中javaweb项目sftp权限相关问题

  • 注意点
    • 用什么角色启动web项目,web项目通过sftp下载的文件就属于哪个角色
    • 配置/etc/ssh/ssh_config参数时,优先指定为组,而不是角色,
      • 因为启动web的角色如果不是sftp角色时,容易出现下载的文件不能被其他节点通过sftp获取
      • 这样就不用修改文件的相关权限,又能使文件继续流通
      • 相关参数为
        • Match User sftpuser
        • Match Group sftpuser
    • 不要把root用户拉到sftp组里,会造成节点无法通过xshell用root用户登录
    • 为安全起见,修改ssh相关配置文件,要做原配置备份,或在配置里把要改的注掉,换行补充
    • 为安全起见,ssh服务重启后要查看状态,还要在xshell的会话管理器里点击查看是否能正常连接对应的节点
    • 修改ssh配置文件,要重启sshd才能生效,如下相关日志

相关问题解决借鉴

linux下SSH远程连接服务慢解决方案 - 邱明成 - 博客园 https://www.cnblogs.com/qiumingcheng/p/5797551.html
ssh与sftp登录对端缓慢问题解决_运维_推背图的博客-CSDN博客 https://blog.csdn.net/qq_37467907/article/details/93618122

方案二:改善ssh服务
1、查看ssh 客户端配置文件/etc/ssh/ssh_config(注意不是sshd_config),修改host:GSSAPIAuthentication no,不使用GSSAPI来鉴权。
2、修改sshd_config 添加行UseDNS no关闭ssh的dns查询,然后重启sshd(这个修改对此不大)

Linux命令之sftp - 安全文件传输命令行工具-毛虫小臭臭-51CTO博客 https://blog.51cto.com/moerjinrong/2050593?utm_source=oschina-app


[root@localhost audioTemplate]# vim /etc/ssh/sshd_config 
[root@localhost audioTemplate]# service sshd restart
停止 sshd:                                                [确定]
正在启动 sshd:                                            [确定]
[root@localhost audioTemplate]# groups sftpuser
sftpuser : sftpuser lmn
[root@localhost audioTemplate]# vim /etc/ssh/sshd_config 

# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
#Subsystem      sftp    /usr/libexec/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server

Subsystem sftp internal-sftp
#Match User sftpuser
Match Group sftpuser
ChrootDirectory /data/ftp_template/shendi
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
"/etc/ssh/sshd_config" 147L, 4070C       

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值