SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I cannot understand why the system refuses to run this program. It did until yesterday. No longer now and I am using a security copy of the program. Besides, who is saying 'Cannot open ./setuid_06'? What can the system possible find wrong with the program?
NOTE: why I had to set the "set user or group ID on execution" bit I do not remember.
No, I didn't. But I forgot something. I have the program source file. Now I'm trying to compile it in this, which is a 64-bit machine. Unfortunately, I get:
Code:
semoi@server:~/z80_p4/juan$ gcc -O2 -o p1 p1.c
p1.c:26:42: fatal error: asm/io.h: No such file or directory
compilation terminated.
The source has this line:
Code:
#include <asm/io.h> // for outb
locate asm/io.h finds hundreds of instances. I do not understand. In what directory should asm/io.h should be?
Well yeah, if you try to run a 32 bits binary on a 64 bits system without any kind of multilib packages installed, this won't work for sure.
I don't think compiling it by hand without any kind of makefile or even some instructions from the maintainer of this program is a good idea.
I would suggest to install the multilib packages provided by alienBOB and then try again to launch the compiled binary to see how it goes.
But it is I who wrote the program and I have run it without problems many times already. Forget about the compilation on the 64-bit machine (gcc will produce 64 bit code). I was wrong. Do as if I were running a 32-bit machine. The program must do I/O. So it must do a setuid. For that, the owner must be root, otherwise the system won't let the program to do the setuid. As I learned in the internet, I must set the "set user or group ID on execution" bit of the file. So the file is left with these permissions:
-rwsr-sr-x
I always did this and the things went well. Now, when trying to run it, I get the 'Cannot open <file name>' message. If I remove the "s" bit, however, I can run it. But then the system does not let the program do the setuid. I must have touched something in the system. I have to recollect. Or perhaps I'm obviating some step now. But the source is exactly the same as when everything went well.
The code is old and needs to be updated for current kernel header layouts.
Thank you very much. I was making a mistake. The program must be compiled in the 32-bit machine where it is to be run. That is, ggc must compile for 32 bits. To make it easy, I compile in the 32-bit machine remotely from a 64-bit machine (more comfortable place to work in). So no problems with the compilation now.
What I can't do is make run. I explained these things in the post above this. Again thanks, wildwizard.
the program checks for errors. In case it finds one, it prints the infamous message "Cannot open <argv[0]>". Here, a second error, because it should be argv[1], the filename that the user must type after the program name. I systematically forgot to specify a filename in the command line. Because I mistakenly wrote argv[0], the resulting message was 'Cannot open ./setuid_06', the name of the program. However the program should warn there is no argument. I had quite forgotten how to use it. That was my great question. Generally system and utilities messages are preceded by the name of the one who talks. This was preceded by nothing! For the record, I made this circumstance explicit in the thread.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.