Answer the question
In order to leave comments, you need to log in
Files and folders created by the application go past the NFS mounted folder - how to fix it?
Hello!
There is a Debian9 VPS that needed more disk space to store images. It has a service that loads images for the site using links and writes them to the catalog by category subfolders.
There is a Server with Debian9 and a large disk.
The nfs-kernel-server is installed on the Server, the host1 user is added, which is identical to the user on the VPS with the same uid and gid. A folder for images /home/host1/img was created in its directory.
In /etc/exports Server were written:
/home/host1/img VPS_ip(rw,no_root_squash,no_subtree_check,crossmnt,fsid=0)
Server_ip:/home/host1/img /home/host1/www/host1.ru/content/img nfs rw,async,hard,intr,noexec 0 0
NEED_IDMAPD=yes
[Mapping]
host1-User = host1
host1-Group = host1
Answer the question
In order to leave comments, you need to log in
I solved the problem, it turned out that the whole thing was in the code that recorded everything only locally, even when mounting.
I checked with a simple script that checks the entry in the directory.
I had to rewrite the entire code for myself - everything works, but I still don’t understand why the source code behaves this way. It seems that the directories are calculated from the root, and this should not affect the location of the folder. As if it also prescribes ip root. And yet, I didn’t really get to the bottom of it.
I met another similar unresolved issue on a stack or similar, but there the application was in java. Apparently, you can somehow dodge, so that it would write exclusively locally, ignoring the mounts.
NFS also had to be abandoned, a day later an abuse came from the German network supervision with a warning that the portmap could be used remotely for DDoS attacks. Although in the manuals for version 4 they write that it is not needed and has been replaced by another service, for some reason portmap is included. Of course, you can configure it and register ports, but nevertheless.
Installed and configured SSHFS, it seemed to me a little easier to set up, although it has its own nuances. Especially if you put it on a permanent basis with the task of autorun after a server reboot and for a specific user. But it is better suited if the ball is needed for access by a limited number of users.
I should note that the network is full of different manuals copying each other with different variations and on different versions, both on NFS and on SSHFS, which, due to inexperience, are misleading and misunderstanding. And official docks are very scarce.
In detail on NFS, I recommend:
1) www.k-max.name/linux/network-file-system-nfs
2) chschneider.eu/linux/server/nfs.shtml
For SSHFS, perhaps you should start from here: https://wiki. archlinux.org/index.php/SSHFS_(%D0%A0...
And then it depends on the ability to configure SSH, access by keys, rights and automounters.
1) rights
2) soft link
options, when something does not write to NFS folders, I also met, but now I can’t remember
It is impossible to give an unambiguous answer to the question, since the type of variables is unknown. The expression means checking for the possibility of having a null value.
var (meaning the type is determined by the compiler) x = y ?? (this is a null check) 10.
If y = null, then x = 10. If y != null, x = y.
At the same time, the important thing is that y must be either a reference value or Nullable. Those. y is most likely declared as int? y.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question