# GNU Chess problem: I can only play games as root



## bigtoque (Jul 17, 2011)

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:

```
-r--r--r--  1 root  wheel
```

Edit:

If I change the permissions to:

```
-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?


----------



## pmooney (Jul 21, 2011)

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.


----------



## vsoto (Jul 21, 2011)

*For comparison*

One of the opening books for games/crafty:


```
-rw-rw-r--  1 nobody  nogroup  2653860 Jul 10 03:15 /usr/local/lib/crafty/book.bin
```


----------



## fwaggle (Jul 22, 2011)

As for why on earth it demands to write to that file, that's probably an issue with either the author or the maintainer.


----------



## Rock (Sep 29, 2021)

I have no problem as root. Non-root gave an error. The fix. Change 
	
	



```
"gnuchess" -x
```
 to include the 
	
	



```
-x
```
 in .xboardrc.


----------



## grahamperrin@ (Oct 2, 2021)

bigtoque said:


> … 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):


----------



## Rock (Mar 3, 2022)

I have to load the engine in xboard at least at startup


----------



## Rock (Nov 25, 2022)

grahamperrin@ said:


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


No interface by looking at figure.


----------



## Voltaire (Nov 25, 2022)

Rock said:


> 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:





						FreshPorts -- games/dreamchess: OpenGL chess game
					

DreamChess is an open source chess game.  It features 3D OpenGL graphics and provides various chess board sets, ranging from classic wooden to flat figurine. Other features include music, sound effects, on-screen move lists using SAN notation, undo functionality, and savegames in PGN format. It...




					www.freshports.org
				








						FreshPorts -- games/jchessboard: Chess game and PGN viewer/editor written in Java
					

JChessBoard is a chess game and PGN viewer/editor written in Java that can be connected to another JChessBoard via a direct TCP/IP connection. No Internet Chess Server is required for playing.




					www.freshports.org
				








						FreshPorts -- games/brutalchess: Nice looking OpenGL chess game
					

Brutal Chess features full 3D graphics, an advanced particle engine, and several different levels of intelligent AI, inspired by the once popular "Battle Chess" released by Interplay circa 1988.




					www.freshports.org
				











						GitHub - jwiegley/emacs-chess: A complete chess client written in Emacs Lisp.
					

A complete chess client written in Emacs Lisp. Contribute to jwiegley/emacs-chess development by creating an account on GitHub.




					github.com
				



You could also use the Linux emulator, or wine, or one of the many retro game emulators to have additional options for playing chess.


----------



## kpedersen (Nov 25, 2022)

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.


----------

