Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2046  / 3 Years ago, sat, august 14, 2021, 4:25:06

I have a LAMP server setup. I have the source folder in my desktop which I can edit without 'sudo'ing. Then, I sync the files to var/www using sudo rsync. I gave the folders in var/www necessary permissions (770 for the mentioned folder, since www-data is added to root group, and apache has to write to this directory, that is upload directory). It works well. But, when I restart the computer, files in the upload folder in var/www disappears. I cannot understand what is happening.



  drwxrwxr-x 2 root www-data 4096 Dec 15 08:26 uploaded_files


my folder permissions look like this.



EDIT: The files disappear some time after the upload.



I'm just confused like hell.



Any help will be appreciated. I'm a newbie in linux file, folder permission btw.



Thanks.


More From » lamp

 Answers
4

I had my source files in my Desktop, and I was syncing with var/www manually so that I don't have to sudo files individually. I was achieving this by syncing the entire desktop folder whenever I felt syncing is necessary. I used the '--delete' bit in my rsync command, so that any extra files in the destination which might have been deleted in my Desktop source, will be removed.



Here is the catch: I have a /upload/dir in my desktop, but nothing really gets uploaded, since it is done in document root, which is /var/www/. So, whenever I sync files, my Desktop /upload/dir (which is empty and will always be) replaces the /upload/dir in the document root. Hence the content disappeared.



Moral (for me & new linux users): Never blindly copy commands in terminal, without getting a basic understanding.


[#33666] Saturday, August 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
listeerrated

Total Points: 354
Total Questions: 112
Total Answers: 100

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
;