LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   changing ownership of 'file name' : operation not permitted (https://www.linuxquestions.org/questions/linux-newbie-8/changing-ownership-of-file-name-operation-not-permitted-838022/)

Virgil B 10-14-2010 08:22 AM

changing ownership of 'file name' : operation not permitted
 
I`ve been given a project to design a program that will interface with a hardware device through the parallel port.And so far it`s not going go.
I managed to write the programe an compiled it, but when runing it the compiler says: 'changing ownership of'and then the file name then it continues to say, 'operation not permitted'.
Guys please help!

its already overdue.

prayag_pjs 10-14-2010 08:24 AM

May ge super user issue

Run it as root

Quote:

su -
or use

Quote:

sudo

Virgil B 10-14-2010 08:31 AM

yes I am running it as root, the su method, and if I don`t use the root it says segmentation fault.

beezlebug 10-14-2010 08:40 AM

We need more information.

Which compiler and compiler version do you use? Which distribution? What is your compile command? Where are your files located (ls -l)?

If you are trying to run the program, the compiler doesn't do anything.It did it's work before.

The code would also be helpful.

szboardstretcher 10-14-2010 08:40 AM

Quote:

Originally Posted by Virgil B (Post 4127159)
yes I am running it as root, the su method, and if I don`t use the root it says segmentation fault.

If you don't need it, turn off SElinux and try again. Here is some information about SElinux - http://wiki.centos.org/HowTos/SELinux

I think you can run the command "cat 0 > /selinux/enforce; reboot" to disable it and reboot.

Virgil B 10-14-2010 08:51 AM

[QUOTE=Virgil B;4127146]I`ve been given a project to design a program that will interface with a hardware device through the parallel port.And so far it`s not going go.
I managed to write the programe an compiled it, but when runing it the compiler says: 'changing ownership of'and then the file name then it continues to say, 'operation not permitted'.

Im using a LINUX G++ compiler, what version i don`t know,and im using the command
su
{enter possword}
chown root:root scriptname
chown 4755 scriptname

and I saved as an .c file

PLEASE DONT BE TO HARD ON ME GUEST IM NEW ON THIS PROGRAMMING ENVIRONMENT,EXPLAIN AS CLEARLY AS POSSIBLE.

I ONLY KNOW A HAND FULL ABOUT PROGRAMMING AND ITS LANGUAGES

mumpster 10-15-2010 01:28 AM

Segfaults
 
Hello!
Virgil, segfaults are usually signs that you have escaped allowed address range due to programming mistakes or other false assumptions. I.e. you address null pointer (quite typical) and so on.
AFAIK, to check parallel port you just need to send something to it
through command line interface like this:
echo -e "\\033E" > /dev/lp0
HP LJ/DJ should eject a paper sheet (reset itself), Epson will just switch bold font on so it's all harmless for a printer.
If this all works, 100% you've got something wrong in your program.

[QUOTE=Virgil B;4127185]
Quote:

Originally Posted by Virgil B (Post 4127146)
I`ve been given a project to design a program that will interface with a hardware device through the parallel port.And so far it`s not going go.

[/B]


jmc1987 10-15-2010 01:42 AM

If you are using g++ asumming you are coding in c++ you need to save your file as .cpp saving the file with .c is used for c language and not c++. If you are coding C language then you need to use gcc and save as .c

Good luck to u

Note
man g++

That will give you the man page and give you some command to tell version etc.

NitinkumarYemul 10-15-2010 01:58 AM

If you are running the program as root then the process real uid will be root uid. But to determine what resources the process can access effective uid is used. I think in your case effective uid is not privileged to change the ownership of the file(On most of the system only root can change the ownership)

You can make sure by printing the real uid and effective uid of the process (getuid(),geteuid()).

If the process effective uid is not equal to root uid then try setting effective uid to root uid(seteuid())

lxop 10-15-2010 05:16 PM

It would probably be helpful if you could be more specific about when you get the error, where the file lives, etc. So perhaps run the commands you listed above, and then copy/paste everything from the terminal into a post here. The basic rule is: The more information you give, and the more specific it is, the easier it is to help you.


All times are GMT -5. The time now is 04:31 AM.