I have Mail in a Box successfully installed and configured. I want to create a webpage for my non-admin users providing instructions for configuring their email clients, using webmail, etc. I also want to use .htaccess and .htpasswd files to password protect the page from the public.
I have set up FileZilla using the correct SFTP protocol with my key file and password prompt on port 22. I can successfully log in and access the directory /home/user-data/www/default. I can open the index.html file locally, but I am unable to successfully edit and save changes. All attempts to upload anything fails with the following message:
Error: /home/user-data/www/default/index.html: open for write: permission denied Error: File transfer failed
Error: /home/user-data/www/.htaccess: open for write: permission denied Error: File transfer failed
I don’t understand why permission is denied when I am using SFTP protocol with my key file. Please help!
Your normal user account will not have access, Filezilla will work with the root account, OR add your user to the “user-data” group:
adduser AccountName user-data
Linux permissions are very different from windows, but it makes sense right? So as an example:
the /home/user-data folder (and subfolders & files) are owned by the user “user-data”, so if your username is for example “heather” (From your username on here, just an example) Your username needs to be in the same group as user-data, which for mail in a box is “user-data” (In the case of MIAB, the user “user-data” is also in a GROUP called “user-data”)
To confirm that you are in the same group:
While logged in with “heather” and NOT under sudo -i, run “groups” to get a list of groups your account is in. If that does not work for you, you can try logging into filezilla with the ROOT account on your server, or logging in as user-data. I just use my root account because it is easier.
@JoshData My way seems to be a work-around, what would be the “proper” way to do this?
For .htaccess - That is specific to Apache, (Although the site https://winginx.com/en/htaccess claims to be able to convert htaccess files to nginx configs.)
Thanks for the response, but I am confused. I followed your instructions to add my account name on the server to the user-data group, Now when I run “groups” under my server username I am listed in the group user-data. (I use Putty with a keyfile to log in). However, when I log into the server on FileZilla, using my server username and the corresponding keyfile, I still don’t have permissions to transfer files. I have also tried using WinSCP with similar results.
I got it to work finally by getting the permissions right. I have now been able to update the static html page. Now how can I password protect that page? I am unfamiliar with nginx so I would appreciate your recommendations. Thanks!
hi . if you got the correct solution , Please share how you did it , I’m in a much need for a proper solution
the problem is i can write into /var/app/current/myapp/ but i can’t replace previous files or overwrite them from filezilla
You have to chmod 775 the folder/folders inside the /home/user-data/www.
Assigning the group permissions is not enough.