I am having a problem with some files within virtual domains being changed or replaced and do not know how to find out which UserID is responsible for the change or the date/time of the change.
Is there a facility that will allow me to find out when and by who any file withing the public html folder for each virtual domain has been uploaded or replaced?
Hello @BPR and welcome to the community.
Virtualmin File Manager will display this information. You could launch the file manager and browse through the directories under /home for the virtual servers that you have hosted on your system.
Again, the file manager will show date and time of creation / last modification of a file. You also want to know which user has created / modified the file, right? Then in Virtualmin, create an account for each user of a virtual server and get them to login with their own credentials instead of using the default user that Virtualmin creates at the time a virtual server is created. If every user who operates the virtual server has his own credentials then the Virtualmin file manager will show you the user who has created / modified a file as well as the date and time on which the file was created / modified.
For example, when you create a virtual server for domain name example.tld, then Virtualmin will create a user named “example”.
If you let multiple users use the credentials of the example user (userx logs in as “example”, usery logs in as “example” and so on) then it becomes difficult to track which person has created / modified which file that belongs to the virtual server.
But if you create additional users under a virtual server (via Virtualmin → Edit Users) and get multiple users to login with their own respective username and password (userx logs in as userx, usery logs in as usery and so on) then the system will give you the information you want about which user has created / modified a file and on which date and time.
Is there a way to create user that can manage all virtual servers in the VPS?
The quick and dirty way would be to create additional users with root privilege.
Let’s please create new topics to discuss things which are different from the title of the current topic.
Thank you to both technicalw and calport for your replies.
I have learned a bit more about what is going wrong now.
I believe the issue causing the problems with unexpected deletion of some files is the use of FileZilla SFTP (SSHD UID for each Virtual Domain) … for some reason that I do not yet understand the SSHD session used by FileZilla to either upload changed files or attempt to edit a live file does not always close when the specific FileZilla instance on a WIndows 10 client PC is closed … it sometimes appears to remain open after the FileZilla PC Client application is closed and even when the PC running FileZilla is rebooted. The next FileZilla session using a different UID for a different Virtual Domain from the PC that the users believes is closed then appears to make changes to the public_html folders of both of the UIDs and sometimes overwrites the files with the same name that belong to the folders within the folders owned by the previous FileZilla connection which the user expected to be closed.
I don’t know why yet … but have concluded the safest way to proceed for now is to avoid using FileZilla SFTP to manage the Virtual Domain files … I will attempt to get users to use Virtualmin file manager instead.
I have not found an ‘easy’ or simple way to detect these unexpected changes … it usually only becomes obvious when a Website user request returns an incorrect file or produces an RC404.
You should use Virtualmin’s File Manager. It is feature rich and robust. It offers advantages over FTP type clients since it works ‘on the server’, so to speak.
I think the improvement here would be is to add logging to FIle Manager module and all of its actions. @Jamie what do you think about it?
Although I agree with your suggestion, I do not have the ability to prevent users from using any FTP or SFTP client they want to.
Possibly a lower priority future work item.
I would like to see file change logging … possibly even a versioning or backup copy of files within public_html folder to make it easier to recover the previous version of a file … in case of an accidental corruption or deletion of a valid file.
But, I think that simply using File Manager that is restricted to a specific user and only that user’s files which I think works now would likely prevent or a least mitigate a repeat of the problem with unintended file deletions.
You could do it already as
git add public_html
git commit -m 1