Mobile app version of vmapp.org
Login or Join
Looi9037786

: Can't Make Changes via FTP on my Ubuntu Server I'm very new to server management, I literally just set this up for the first time a couple weeks ago, no idea what I'm doing. In order to

@Looi9037786

Posted in: #Apache #Ftp #Linux #Server #Ubuntu

I'm very new to server management, I literally just set this up for the first time a couple weeks ago, no idea what I'm doing.

In order to allow WordPress to run updates, apparently everything needs to be owned by www-data, but if everything is owned by www-data, I can't FTP with the user revxx14. When I try, I can't make any changes (deletions, additions, updating files, nothing. I get permission denied errors across the board). Is there a way to give my user the same permissions as www-data, so that I'll be able to keep www-data the owner, but still be able to make changes via FTP?

Thanks.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Looi9037786

2 Comments

Sorted by latest first Latest Oldest Best

 

@Courtney195

When in your Terminal window, you can type ls -l to see the current file permissions and user and group that owns the file. This article from Ubuntu's Community explains how the file permissions are built: help.ubuntu.com/community/FilePermissions
Now, to anwer your question, if you want to change a file or folder as a certain user, the user must either be:
the owner/creator of the file (again refer to ls -l) or;
member of the group the file is owned/created with.


Thus, if ls -l shows something like -rw-rw-r-- root www-data, the file is owned by root and is in the www-data group and can gives Read and Write access to the user and group and only Read access to the World. Since revxx14 is not root nor in the group www-data you cannot edit the file.

Now, in terminal you can add yourself to the www-data group:
usermod -a -G www-data revxx14

Now you're a part of the group you also have Read/Write access to the file.
If you still get permisison errors after adding yourself to the group, make sure the file is in the www-data group (you can change this with chgrp www-data somefile.txt) and the file is writable by the group (you can change this with chmod g+w somefile.txt).

Last but not least, if you want to create a file in a folder, you need to have write access to the given folder. The file created will be owned by you and the primary you're in, thus should have Read/Write access by default.

10% popularity Vote Up Vote Down


 

@Sherry384

Yes you can. I do not know WordPress, but this seems like just a permissions issue anyway. You can do one of several things. First, if the user www-data can FTP then that would be expedient, but perhaps not as safe as you want it to be since www-data should not have FTP permissions for security reasons. Alternatively, your user revxx14 could be modified to join the group that www-data belongs to and the file permissions modified to allow group modifications. This would allow you to drop the files into place, but you may still need to change file permissions.

However, the best solution is what I do. I create a temporary directory within the users home directory (in this case revxx14). I FTP the files there. Then I SSH in and copy the files from the temporary directory to the website with appropriate permissions. You would use cp to copy the files from your temporary directory to the destination, chown to change the destination file ownership, chgrp to change the destination file group ownership, and lastly chmod to change the permissions of the destination files. Lastly, use ls to check that you did your work correctly. Take note of the file ownership, group ownership, and permissions before you begin.

If you are not familiar with this process, create a situation where you practice using these commands where it would not matter if you make a mistake. Perhaps from one user to another user temporary directories. You may need to use mk to make the temporary directories.

Keep in mind that the files withing the web space are set specifically for security reasons and that should not change. If you copy these files from your temporary directory to the web space, then the files would have revxx14 users ownership, group ownership, and default permission. This means that for each file you copy, you would need to set the ownership, group ownership, and default file permissions to match the original file or other similar files. For example, some may have execute permissions while others only have read or read/write.

For myself, I know my files ownership and permissions natively so I can do mass file ownership and permissions changes using wild cards. I would only recommend using wild cards when you are sure of what you are doing. If you feel comfortable with the commands above, then you can use wildcards too.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme