LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2010, 08:22 AM   #1
Virgil B
LQ Newbie
 
Registered: Oct 2010
Location: durban,South Africa
Posts: 5

Rep: Reputation: 0
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.
 
Old 10-14-2010, 08:24 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
May ge super user issue

Run it as root

Quote:
su -
or use

Quote:
sudo
 
Old 10-14-2010, 08:31 AM   #3
Virgil B
LQ Newbie
 
Registered: Oct 2010
Location: durban,South Africa
Posts: 5

Original Poster
Rep: Reputation: 0
yes I am running it as root, the su method, and if I don`t use the root it says segmentation fault.
 
Old 10-14-2010, 08:40 AM   #4
beezlebug
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
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.

Last edited by beezlebug; 10-14-2010 at 08:40 AM. Reason: spelling error
 
Old 10-14-2010, 08:40 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by Virgil B View Post
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.
 
Old 10-14-2010, 08:51 AM   #6
Virgil B
LQ Newbie
 
Registered: Oct 2010
Location: durban,South Africa
Posts: 5

Original Poster
Rep: Reputation: 0
[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

Last edited by Virgil B; 10-14-2010 at 08:56 AM.
 
Old 10-15-2010, 01:28 AM   #7
mumpster
LQ Newbie
 
Registered: Apr 2008
Location: Novosibirsk, Russia
Posts: 5

Rep: Reputation: 0
Smile 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 View Post
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]
 
Old 10-15-2010, 01:42 AM   #8
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
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.
 
Old 10-15-2010, 01:58 AM   #9
NitinkumarYemul
LQ Newbie
 
Registered: Oct 2007
Location: India
Distribution: Fedora 13
Posts: 11

Rep: Reputation: 1
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())
 
Old 10-15-2010, 05:16 PM   #10
lxop
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] chown: changing ownership of `<file>': Operation not permitted schuurs Linux - General 14 06-26-2013 05:15 PM
5.32. Changing Ownership - Operation not permitted basheer Linux From Scratch 6 05-17-2012 04:57 AM
chgrp: operation not permitted even though I own the file! the theorist Linux - Newbie 16 05-28-2010 11:02 PM
chmod: changing permissions of `public_html': Operation not permitted painterj Linux - Newbie 11 04-09-2010 09:40 PM
failed to preserve ownership operation not permitted yogks Linux - Software 1 11-27-2008 04:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration