mojira.dev
MC-122621

Snapshots do not function in shared hosting environments

The latest snapshots do not work properly in a shared hosting environment.

Utilizing Multicraft, each server has its own user and its own folder stored in <multicraft dir>/servers/server<id>, and that user does not have access to the overall `/servers` directory.

As it stands the snapshot attempts to create a folder outside of the server's running directory (./../backups), so that would be in <multicraft dir>/servers prompting an AccessDeniedException and preventing the server from starting.

To fix this issue, either allow setting a custom backup directory via command line, or create the backups folder in the server's running directory.

[12:20:49] [main/FATAL]: Failed to start the minecraft server
java.lang.RuntimeException: java.nio.file.AccessDeniedException: <multicraft dir>/servers/server574054/./../backups
    at bit.<init>(SourceFile:36) ~[minecraft_server.17w47b.jar:?]
    at biq.<init>(SourceFile:38) ~[minecraft_server.17w47b.jar:?]
    at net.minecraft.server.MinecraftServer.<init>(SourceFile:194) ~[minecraft_server.17w47b.jar:?]
    at pw.<init>(SourceFile:71) ~[minecraft_server.17w47b.jar:?]
    at net.minecraft.server.MinecraftServer.main(SourceFile:744) [minecraft_server.17w47b.jar:?]
Caused by: java.nio.file.AccessDeniedException: <multicraft dir>/servers/server574054/./../backups
    at sun.nio.fs.UnixException.translateToIOException(Unknown Source) ~[?:1.8.0_111]
    at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_111]
    at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_111]
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(Unknown Source) ~[?:1.8.0_111]
    at java.nio.file.Files.createDirectory(Unknown Source) ~[?:1.8.0_111]
    at java.nio.file.Files.createAndCheckIsDirectory(Unknown Source) ~[?:1.8.0_111]
    at java.nio.file.Files.createDirectories(Unknown Source) ~[?:1.8.0_111]
    at bit.<init>(SourceFile:34) ~[minecraft_server.17w47b.jar:?]
    ... 4 more

Linked issues

Comments 8

Thank you for your report!
However, this issue is Invalid.

Your game, launcher or server is modified.
If you can reproduce the issue in a vanilla environment, please reply with a comment here.

– Any non-standard client/server/launcher build needs to be taken up with the appropriate team, not Mojang.
– Any plugin issues need to be addressed to the creator of the plugin or resource pack.
– If you have problems on large servers, such as The Hive and Hypixel, please contact them first as they run modified server software.

Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki

Can you elaborate - are you referring to the use of Multicraft in order to launch the server? The JAR itself is vanilla.

This is a glaring flaw in the design of the backup system, assuming that the server has ownership over the folder outside of its executing environment. The server software shouldn't be attempting to modify files outside of its running directory.

Exactly, Multicraft is a third-party launcher, so it is not supported by Mojang. To be fair, I have no clue about which /servers/ subfolders you're talking, those don't exist normally.

Hello,

I can clearly say this is NOT invalid and it's an issue. Even if you create and run the Minecraft Snapshot through the console. It still creates a `backups` folder outside its directory. This should not be doing this.

This is not invalid and actually does this on Windows as well.

Nothing is modified and completely a vanilla JAR.

Kind Regards,
Cory

Perhaps the issue would have been better stated as this:

This type of behavior (creating a folder outside of its executing folder) is potentially unintended. It is a very strange behavior. It would make more sense if the backups folder was created inside of the server's launching folder, rather than outside, which makes an assumption that the server owns a folder outside of its running folder, which is not always the case.

If this is intended, it is a bad design atypical of what any software should do. It breaks established hosting environments with no viable alternative to designating a different backup location.

A potential solution for shared hosts and users utilizing panels such as Multicraft right now would be to allow access to this backups directory for all servers - <multicraft dir>/servers/backups Though since all servers reside in their own folder within the same parent directory, the backups folder would be shared by each server on the machine - bad design!

Being that this is potentially unintended behavior in their backup system, Mojang should be made aware of this problem.

An addendum to the above, this is reproducible on Windows with no additional launcher as long as the user account doesn't have access to the server's parent directory.

Let's say I want my server to be located in my Users folder, exactly C:/Users/Dusty/. So I place the server JAR there and start it. My user account doesn't own the Users folder though in Windows, so we get the same issue when trying to start:

PS C:\Users\Dusty> java -jar minecraft_server.17w48a.jar
[17:28:32] [main/FATAL]: Failed to start the minecraft server
java.lang.RuntimeException: java.nio.file.AccessDeniedException: C:\Users\Dusty\.\..\backups
        at bix.<init>(SourceFile:36) ~[minecraft_server.17w48a.jar:?]
        at biu.<init>(SourceFile:38) ~[minecraft_server.17w48a.jar:?]
        at net.minecraft.server.MinecraftServer.<init>(SourceFile:197) ~[minecraft_server.17w48a.jar:?]
        at px.<init>(SourceFile:71) ~[minecraft_server.17w48a.jar:?]
        at net.minecraft.server.MinecraftServer.main(SourceFile:748) [minecraft_server.17w48a.jar:?]
Caused by: java.nio.file.AccessDeniedException: C:\Users\Dusty\.\..\backups
        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) ~[?:1.8.0_151]
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_151]
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_151]
        at sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source) ~[?:1.8.0_151]
        at java.nio.file.Files.createDirectory(Unknown Source) ~[?:1.8.0_151]
        at java.nio.file.Files.createAndCheckIsDirectory(Unknown Source) ~[?:1.8.0_151]
        at java.nio.file.Files.createDirectories(Unknown Source) ~[?:1.8.0_151]
        at bix.<init>(SourceFile:34) ~[minecraft_server.17w48a.jar:?]
        ... 4 more

Because, it's trying to create the /backups folder in C:/Users, not C:/Users/Dusty, which is where the server is running from. The backup location being specified as .\..\backups as per the stack trace is an odd notation, <current dir>\<parent dir>\backups? It seems as if just .\backups may have been intended, indicating to create it in the current directory only.

That does sound wrong. In single-player it's supposed to put them into .minecraft/backups (relative to .minecraft/worlds, maybe?). But on a server the directory equivalent to "worlds" is the root for the server.

Duplicate of MC-122295. Will edit that issue to clarify exactly what's going on.

Note that there is the --universe command-line argument, but that's for changing the complete location of the server. You could move the server into a subfolder to work with shared hosting, but this is definitely a bug.

Dusty A

(Unassigned)

Unconfirmed

Minecraft 17w48a

Retrieved