Some doubts in Linux

Some doubts in linux. Any help will be appreciated. Thanx in advance

1)  I do not have conio.h on my linux pc. Substitute for functions such as clrscr,getch etc.?

2)  I have math.h. But the functions pow,floor etc.etc. are not defined there. What do i do apart from writing these functions myself?

3) How do i initialize the graphics system in linux? There is no graphics.h. There is a vga.h but does it mean I have to write the plotting functions myself and use the ROM-BIOS services for going to the graphics mode (in short write a graphics.h myself!). What is the alternative?

4)  As the root user, how do i change the default installation directory of the RPM packages that i install?

5)  Require some additional info about the 'setuid' feature. It is possible to change the effective id of a process to 'root' using this. Doesn't this mean that security is severely compromised. I could very well delete the kernel file if i have a process executing with root privileges.

1)  most of your CLI terminal based functions are implemented in NCurses
you will also find getch() there

2) pow() and floor() ARE in math.h

3) this REALLY depends on what you are trying to do. I don't do any graphics programming myself (yet), but
look into Qt and GTK .. they are GUI API's for KDE and Gnome (respectively) but there are several different
ways to do these.

4) i'm not sure, i've never done it (or needed to), my advise is to NO muck around with the standard placement of files in linux. MS has corrupted an awful lot of folks by the way they pile up a dozen different types of files in the same directory. I tend to not use RPMs much (i build most software from source)

5) setuid IS DANGEROUS. Personally, if I write a piece of software that needs root privileges, then ONLY root
should be able to run it.

If you could be more specific about what you're trying to do by changing install locations for RPMs and why
you need to use setuid, I could probably be more helpful.

Also, learn to use 'man', it is a lifesaver. (ex. 'man pow' gave me the info on the pow() function.)

If you need any more help, please feel free to ask.

Thanx a million!

1) The Gimp toolkit is for GUI. I want to use graphics on the console. That is because I have made games in DOS that use the graphics subsystem of dos. I want to port them to linux.

2) The man pages are quite helpful as u pointed out and thanx for that. When I had tried to compile a simple program that contained the pow and floor functions, I got errors saying that the functions must be used first(declaration errors). So I had posted that doubt. I'll try out the man pages on pow and floor and let u know if I have further troubles.

3) Programs with setuid root privileges need not be executable by the root user only. E.g The 'passwd' program changes the user password in the passwd file which is modifiable only by root. What happens is , passwd program's setuid bit is on. So at runtime, it's EFFECTIVE uid is changed to that of the creator - the root and hence it is able to modify the passwd file. After this is over, the process's EFFECTIVE uid is changed back to that of the user who had executed it. What I want to know is that instead of just modifying the passwd file, I could write a program to delete it altogether. Or delete the kernel itself ! Is this possible or are there any secondary security measures in place?

Other commands that use the setuid feature are mkdir and other commands that make changes to the filesystem.

4) By trying to change the install locations, I am just trying to organise my files. e.g I want games to be installed in /usr/games and not in /usr/bin by default.

Thanx again for the help

1) Sorry, I have NO clue how to or even if you can produce graphics on a terminal.

2) manpages are my best friend. I don't know what i'd do without 'em.

3) I thought you were refering to programs YOU plan to write. As far as your examples, I don't know exactly
what kind of protections exist for that, but as I've never heard of ANY incidents, i've never really thought about it. I'll do some checking tho.

4) I don't know how to do that, but as I said, I try to not muck around with the standard *nix FS tree. If i get some time i'll try to find you some info on that tho.

Even if I write a program, I can set the setuid bit to on by being the root user. I can then execute the program on some other PC. Isn't that possible?

Now that is an interesting question. I've got two linux boxes here so when I get a chance I'll try it.

4) As the root user, how do i change the default installation directory of the RPM packages that i install?

Use the --relocate OLD_PATH NEW_PATH when installing the rpm

HA! see there ya go. we ALL know something, together we're a genius!

Have a Linux Issue?
Do you have a Linux Question?

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.