GNU Chess problem: I can only play games as root

I've got GNU Chess installed from ports, and have installed xboard and eboard.

When I try to start a new game from a normal user account in either xboard or eboard, I get the error:

"book_open(): can't open file "/usr/local/share/gnuchess/book.bin": Permission denied"

I can run the game as root.

The permissions for the file are:
Code:
-r--r--r--  1 root  wheel

Edit:

If I change the permissions to:
Code:
-r--rw-r--  1 root  wheel
I can run the game without any errors.

Why would the game run under root with only read permission, yet not work under normal account with read permission? And why would allowing write permission to the files group matter, if it can be run by root with only read permission?
 
bigtoque said:
Why would the game run under root with only read permission, yet not work under normal account with read permission? And why would allowing write permission to the files group matter, if it can be run by root with only read permission?

Root, being the superuser, can open the file read/write even though the FS permissions are set to read-only. Since your regular user lacks this power, but belongs to the wheel group, g+rw must be set on the file for GNU chess to access it in the manner it wishes.
 
As for why on earth it demands to write to that file, that's probably an issue with either the author or the maintainer.
 
I have no problem as root. Non-root gave an error. The fix. Change
Code:
"gnuchess" -x
to include the
Code:
-x
in .xboardrc.
 
… from a normal user account in either xboard or eboard, I get the error: …

For what it's worth, without XBoard games/xboard, no problem with a normal user account (Chess in foreground, htop in background):

1633161509690.png
 
No interface by looking at figure.
His screenshot is from GNOME Chess. But the OP is talking about xboard and eboard specifically..

There are also a number of other options for playing chess:
You could also use the Linux emulator, or wine, or one of the many retro game emulators to have additional options for playing chess.
 
I have seen this a few times with older UNIX games. They store the "save data" in a root-only writable file to prevent players cheating by modifying the file. It is a bit annoying, especially when they start setuid'ing the programs. It seems a recipe for disaster.

There should be an option to use a different save file (there is on hack/nethack for example). Or you might be safe just using chown on the file if you are the only user planning to use that software.
 
Top