この記事は最終更新から1年以上経過しています。現在の仕様や情報と異なる場合がありますので、ご注意ください。

ubuntuサーバーでFTPを立て、FTPソフトでファイルをアップロードしたところ403エラーが出たのでパーミッションを調べたらデフォルトのパーミッションが600(フォルダは700)になっていたのでそれの変更方法の備忘録です。

当方環境

  • XSERVER VPS
  • ubuntu
  • vsftpd
  • Filezilla
  • macOS ターミナル

解決方法

vsftpd.conf」ファイルを編集します。

local_umask=022がコメントアウトされているのでそれを解除します。もし値が077になってたら022にします

ターミナル

sudo vim /etc/vsftpd.conf

/etc/vsftpd.conf

local_umask=022

これを

#とってあげて

:w :q で編集保存

What you’re probably looking for is the “umask” parameter. If you’re uploading files through vsftpd, the behaviour depends upon the way vsftpd is configured. If it is set up to use system users, you must modify the “local_umask” vsftpd parameter in the configuration file from the default 077 value to 022.

Default File Permissions – Ubuntu & VSFTPD – Unix & Linux Stack Exchange より引用

vsftpdを再起動したら完了です。

ターミナル

sudo systemctl restart vsftpd

変更前のパーミッション(index.htmlとcssフォルダ)

変更後にアップロードしたもの

 

ファイルは644、フォルダは755になりました。