I am root, and I need to restrict write or read access to / directory for a certain user, that is not root. Is this possible via shell or a C progam?
restrict write or read access to / directory for a certain user, that is not root
Yes, use permissions. Every multi-user operating system (including MS Windows, Linux and Unix) has some capability for controlling file access.
While Stackoverflow encourages us to provide inline answers, a full explanation of how Unix permissions work would be a bit over the top in an answer here (don't panic - its not too complex) and I would struggle to do a better job than Paul Sheer does in "Linux:Rute User's Tutorial and Exposition" which is available in print and free pdf's on the internet (chapter 11).
As a taster, the standard Unix/Linux filesystem privileges are Read (r), Write (w) and Execute(d) and each can be applied to 3 categories of users - the designated owner of the file/directory, the designated user group of the file/directory, all users on the host.