I installed WordPress through dietpi-software. And I connected it to my domain using Cloudflare Zero Tunnel.
I am trying to upload file Since my Wordpress folder appears on the www-data user, I cannot send files via ftp connection with the root or dietpi user. “permission denied” I was able to access the root folder of the site with root and dietpi user, I cannot make changes to the files, what can I do?
You can not use User dietpi, since it has no permissions to write to this directory.
And possibly root user is not allowed by the proftpd config,can you have a look into the config file and see if root user is allowed:
<Global>
RootLogin on
UseFtpUsers off
</Global>
Don’t forget to restart the service.
As a workaround you could upload to a folder where your have permissions and then copy it via ssh as root user to the destination
I gave access to the root user in proftpd, I do not use it with default settings. However, the root user cannot write files via FTP to the Wordpress folder visible in the www-data user. Can I connect to ftp with www-data user? Or can I give the root user access to the Wordpress directory? Could giving access to multiple users on ProFTPD also be a solution?
# DietPi ProFTPD default config
# Location: /etc/proftpd/proftpd.conf
# Docs: http://www.proftpd.org/docs/directives/linked/configuration.html
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set "off" to disable IPv6 support which is problematic on IPv4 only boxes.
UseIPv6 on
# If set "on" you can experience a longer connection delay in many cases.
<IfModule mod_ident.c>
IdentLookups off
</IfModule>
UseReverseDNS off
ServerName "DietPi FTP"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
# Permit resuming downloads
AllowRetrieveRestart On
# Permit resuming uploads
AllowStoreRestart On
TimeoutNoTransfer 120
TimeoutStalled 120
TimeoutIdle 240
DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"
DenyFilter \*.*/
DefaultRoot /var/www
Port 21
MaxInstances 8
RootLogin on
User root
Group root
Umask 002 002
AllowOverwrite on
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
# Stop /var/log/wtmp logging: No such file or directory -Gordon Williams change
WtmpLog off
# /var/log/lastlog logging
#UseLastlog on
<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>
<IfModule mod_ratio.c>
Ratios off
</IfModule>
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>
#Include /etc/proftpd/tls.conf
# Include other custom configuration files
Include /etc/proftpd/conf.d/
You can not log in as www-data, it’s a limited user, without a passwort.
Root user can write to every directory, so I still think there is a problem with your FTP config.
I tested it now for myself, for some reason ProFTPD only allows the owner, who owns the directory, to upload to it. Root can not upload to a folder he does not own, which is weird IMO.
So I did:
adduser ftpuser
usermod -a -G www-data ftpuser
Then connecting with this user works.
Does somebody know why ProFTP behaves like that? With samba I don’t have this issues.
Maybe I could consider using another FTP application instead of ProFTPD. Any suggestions?
When another user write a file in this directory, does the www-data user also have access to this file? Otherwise, it is not possible to perform some operations on the WordPress dashboard.
I would use SFTP or samba, I honestly have not much experience with FTP servers.
With SFTP you are then already in the terminal and can quickly change file ownership and permissions.
By default permission in wordpress are 644 for files and 755 for folders, so you would need to change ownership.
Exceptions are wp-config.php and .htaccess / `nginx.conf, which have more restrictive permissions.
If you really need to use FTP the easiest way is maybe to make the login possible with www-data, but for security reasons this is disabled for almost every user on DietPi (I did not test it with www-data, but with my ftpuser):
passwd www-data
to change it back to no login allowed:
passwd -l www-data
(For testing I chwoned my whole wordpress folder to my ftpuser and I can still change stuff in the wordpress backend)
When I use FTP, I can easily do this with the command below. But I’m looking for a solution that I won’t have to deal with every time.
sudo chown -R root:root ./[name of Wordpress folder]
I’m wondering if there might be a problem with my PROFTPD configuration. All I did was add the root user instead of dietpi in the configuration file.
I haven’t tried it yet, but this seems like the most practical solution I’ve seen so far. Thus, I can perform ftp transactions with ftpuser without any problems.
adduser ftpuser
usermod -a -G www-data ftpuser
Additionally, samba server and client packages appear to be installed on the operating system. I don’t actively use it now, I have installed it in the past to try something and failed. Could having these packages installed cause a conflict with the FTP software?