【问题标题】:How do you automatically set permissions on a file when uploaded using a sftp使用 sftp 上传文件时如何自动设置文件权限
【发布时间】:2014-04-30 19:30:45
【问题描述】:

您好,我目前设置了一个文件夹,可以使用 sftp 上传文件。

 drwxrwxr-x. 2 cypress cypress  4096 Apr 30 15:24 sourceit

但是当我上传文件时,它会上传为

-rw-r--r--. 1 cypress sftpusrs    7 Apr 30 15:24 test.file

我需要做些什么来设置它,所以当我上传文件时,它会自动将权限设置为

drwxrwxr-x. 1 cypress sftpusrs    7 Apr 30 15:24 test.file

感谢您的帮助。

我目前在 openssh sshd_config 中为 ftping 设置了所有内容

Match user cypress
ChrootDirectory /mnt/cypress
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp

【问题讨论】:

  • 您需要编辑您的 FTP 服务器配置。您知道您使用哪个 FTP 服务器吗? ProFTPD 或 vsftpd 还是其他?
  • 我目前正在使用 sshd 进行 ftping。
  • lftp 是客户端。你在服务器上用什么。连接到您的服务器时,您应该在日志中获取 FTP 服务器的版本和类型。
  • 我已经在 ssh sshd_config 中为 ftping 设置了一切
  • 您是在使用端口 22 还是 21 ?我怀疑你甚至没有使用 FTP,而是使用 SFTP,这是两个非常不同的东西。

标签: permissions sftp


【解决方案1】:

修改或将此行添加到您的 sshd_config

ForceCommand internal-sftp -u 2

应该应用 002 的 umask。

使用 umask 或 SFTP,无法自动放置可执行文件,这将是一个巨大的安全风险。您必须在单独的命令中运行 chmod 才能执行此操作。

【讨论】:

猜你喜欢
  • 2015-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多