Sign in with
Sign up | Sign in
Your question

NetHack server help

Last response: in Video Games
Share
Anonymous
April 29, 2005 11:51:02 PM

Archived from groups: rec.games.roguelike.nethack (More info?)

I'm trying to make a NetHack server over telnet for some friends, but
I'm having problems. I can launch and play the game without problems,
but when I try to save, it says, "Saving... Cannot open save file." I
am running it with a user called nethack. All of the files in the
nethackdir (as well as the nethackdir itself) are set so that nethack
and members of the group nethack can read and write to all of the
files.

Also, could someone tell me how I could make it so that when someone
logged in it would launch nethack and so that it would log them off if
they quit? (I'm pretty new to Linux.)

More about : nethack server

Anonymous
April 30, 2005 2:05:13 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

I figured out what was the problem. I hadn't saved any games yet so
there was no save folder, and it couldn't make one. So I created the
folder and set the permissions and now the saving works. I'm still
having problems with the scripts, though.
April 30, 2005 7:59:27 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

"DenNorskeGutten@gmail.com" <DenNorskeGutten@gmail.com> wrote in
news:1114829462.299530.153610@l41g2000cwc.googlegroups.com:

> I'm trying to make a NetHack server over telnet for some friends, but
> I'm having problems. I can launch and play the game without problems,
> but when I try to save, it says, "Saving... Cannot open save file." I
> am running it with a user called nethack. All of the files in the
> nethackdir (as well as the nethackdir itself) are set so that nethack
> and members of the group nethack can read and write to all of the
> files.
>
> Also, could someone tell me how I could make it so that when someone
> logged in it would launch nethack and so that it would log them off if
> they quit? (I'm pretty new to Linux.)
>
>

At a guess, and a probably true one I would say that the problem is that you
are not saving games with suid root access. Nethack runs as su to stop
security breaches. In other words, try running the server under root, and
change the save files so only root can write them (but all can read of
course).
Related resources
Anonymous
April 30, 2005 11:27:25 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

chuck <chucko@nil.car> wrote:

>"DenNorskeGutten@gmail.com" <DenNorskeGutten@gmail.com> wrote in
>> I'm trying to make a NetHack server over telnet for some friends, but
>> I'm having problems. I can launch and play the game without problems,
>> but when I try to save, it says, "Saving... Cannot open save file." I
>> am running it with a user called nethack.
>>
>At a guess, and a probably true one I would say that the problem is that you
>are not saving games with suid root access. Nethack runs as su to stop
>security breaches. In other words, try running the server under root, and
>change the save files so only root can write them (but all can read of
>course).

I would hesitate setting NetHack suid root, as I do not believe it to be
necessary. Any such binary on a publically accessible server is just
asking for trouble. In the special case of NetHack, with its hundreds of
buffer write accesses without range checking, even more so.

(If you mean to set the saved games suid, this would not help at all
because they are not executed.)

--
Philipp Lucas
phlucas@online-club.de
Anonymous
April 30, 2005 11:30:35 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

"DenNorskeGutten@gmail.com" <DenNorskeGutten@gmail.com> wrote:

>Also, could someone tell me how I could make it so that when someone
>logged in it would launch nethack and so that it would log them off if
>they quit? (I'm pretty new to Linux.)

Set their login shell to a script?

There are several other public servers available, for example
nethack.alt.org and www.pp.fishpool.fi . In case their administrators are
not reading here, you should ask them per mail; you do not have to
reinvent the wheel.

--
Philipp Lucas
phlucas@online-club.de
Anonymous
April 30, 2005 12:32:58 PM

Archived from groups: rec.games.roguelike.nethack (More info?)

DenNorskeGutten@gmail.com wrote:
> I'm trying to make a NetHack server over telnet for some friends, but
> I'm having problems. I can launch and play the game without problems,
> but when I try to save, it says, "Saving... Cannot open save file." I
> am running it with a user called nethack. All of the files in the
> nethackdir (as well as the nethackdir itself) are set so that nethack
> and members of the group nethack can read and write to all of the
> files.
>
> Also, could someone tell me how I could make it so that when someone
> logged in it would launch nethack and so that it would log them off if
> they quit? (I'm pretty new to Linux.)
>

You might want to have a look at dgamelaungch, too.
It's available here:
http://rock.inode.at/ROCK-2.1/d/dgamelaunch-1.4.6.tar.b...

It's quite easy to set up if you don't use a chroot environment.
Just set the chroot directory in the dgamelaunch.conf file to "/".
The installation process is quite straightforward, there's a good README and
here are a few people with experience about dgamelaunch. So don't hesitate
asking :-)


Greetings,
blindy
May 1, 2005 8:16:59 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

>>
>>At a guess, and a probably true one I would say that the problem is that
you
>>are not saving games with suid root access. Nethack runs as su to stop
>>security breaches. In other words, try running the server under root, and
>>change the save files so only root can write them (but all can read of
>>course).
>
> I would hesitate setting NetHack suid root, as I do not believe it to be
> necessary. Any such binary on a publically accessible server is just
> asking for trouble. In the special case of NetHack, with its hundreds of
> buffer write accesses without range checking, even more so.

Nethack is started (in unix) by a script which then runs the binary. The
binary IS root execute only and the save files are root write only.

> (If you mean to set the saved games suid, this would not help at all
> because they are not executed.)
>
siud means set user id not user execute. Besides the execute bit is also used
for reading directories and searching.
Anonymous
May 1, 2005 8:17:00 AM

Archived from groups: rec.games.roguelike.nethack (More info?)

chuck wrote:
> Nethack is started (in unix) by a script which then runs the binary. The
> binary IS root execute only and the save files are root write only.

That may be true for your particular installation of nethack, but it is
not at all true for all *nix installations, for instance Linux distros
that have clueful package maintainers. Here are the permissions for the
relevant files as installed on my Gentoo system using emerge:

Shell script in /usr/games/bin:
-rwxr-x--- 1 root games 1379 Dec 22 22:34 nethack

Nethack executable in /usr/share/games/nethack:
-rwxr-x--- 1 root games 2487856 Dec 22 22:34 nethack

I run all my local games as a non-root user that is in the games group.
Save files are owned by the same non-root user.

>>(If you mean to set the saved games suid, this would not help at all
>>because they are not executed.)
>>
>
> siud means set user id not user execute. Besides the execute bit is also used
> for reading directories and searching.

Setting a file's suid bit has no real meaning unless its permissions
include execution privilege, which is what the parent to your reply was
pointing out. Setting suid when the executable is owned by root is
widely acknowledged as a security risk that is to be avoided whenever
possible.

-Ken
Anonymous
May 1, 2005 5:36:58 PM

Archived from groups: rec.games.roguelike.nethack (More info?)

chuck wrote:
>>>At a guess, and a probably true one I would say that the problem is that
>
> you
>
>>>are not saving games with suid root access. Nethack runs as su to stop
>>>security breaches. In other words, try running the server under root, and
>>>change the save files so only root can write them (but all can read of
>>>course).

Nonsense. Don't *ever* run *anything* under root when not necessary!

  • That would otherwise evolve to a security problem if the programs have
    flaws.

    And the save files need not to be read by anyone else if you have set the
    SUID flag on the executable.

  • It's completely unnecessary to run nethack as root. You may install
    nethack even under your own account in your local home directory. I do
    that, for example, to test new versions of nethack before I replace the
    system wide files. And even the system wide files won't be installed as
    root.

    >>I would hesitate setting NetHack suid root, as I do not believe it to be
    >>necessary. Any such binary on a publically accessible server is just
    >>asking for trouble. In the special case of NetHack, with its hundreds of
    >>buffer write accesses without range checking, even more so.
    >
    > Nethack is started (in unix) by a script which then runs the binary. The
    > binary IS root execute only and the save files are root write only.

    Apparently it depends on the expertise of the people that install programs
    resp. the people that prepare the ready-to-use packages.

    On my Linux box the executable is defined with SUID flag set as games:games,
    save files have only access permissions for user games and group games.

    Janis
    May 1, 2005 9:53:03 PM

    Archived from groups: rec.games.roguelike.nethack (More info?)

    >
    > Nonsense. Don't *ever* run *anything* under root when not necessary!

  • > That would otherwise evolve to a security problem if the programs have
    > flaws.
    >
    > And the save files need not to be read by anyone else if you have set the
    > SUID flag on the executable.
    >
    There are SEVERAL server client games that do just that, freeciv and
    crossfire are examples. The client runs under a user and the server runs
    under root. The security risk that you must be referring to is allowing
    remote users su privilidges under CERTAIN circumstances. fvwm can be run
    under root with no problems (so long as you don't do stupid things like start
    deleteing files.)


    >
  • It's completely unnecessary to run nethack as root. You may install
    > nethack even under your own account in your local home directory. I do
    > that, for example, to test new versions of nethack before I replace the
    > system wide files. And even the system wide files won't be installed as
    > root.
    we were talking about a client/server operation NOT normal nethack.

    >
    >>>I would hesitate setting NetHack suid root, as I do not believe it to be
    >>>necessary. Any such binary on a publically accessible server is just
    >>>asking for trouble. In the special case of NetHack, with its hundreds of
    >>>buffer write accesses without range checking, even more so.
    >>
    >> Nethack is started (in unix) by a script which then runs the binary. The
    >> binary IS root execute only and the save files are root write only.
    >
    > Apparently it depends on the expertise of the people that install programs
    > resp. the people that prepare the ready-to-use packages.
    >
    > On my Linux box the executable is defined with SUID flag set as
    games:games,
    > save files have only access permissions for user games and group games.
    >
    > Janis
    >
    Anonymous
    May 2, 2005 12:47:00 AM

    Archived from groups: rec.games.roguelike.nethack (More info?)

    chuck wrote:
    >>Nonsense. Don't *ever* run *anything* under root when not necessary!

  • >>That would otherwise evolve to a security problem if the programs have
    >>flaws.
    >>
    >>And the save files need not to be read by anyone else if you have set the
    >>SUID flag on the executable.
    >
    > There are SEVERAL server client games that do just that, freeciv and
    > crossfire are examples. The client runs under a user and the server runs
    > under root. The security risk that you must be referring to is allowing
    > remote users su privilidges under CERTAIN circumstances. fvwm can be run
    > under root with no problems (so long as you don't do stupid things like start
    > deleteing files.)

    Don't *ever* run *anything* under root when not necessary!

    Janis
    !