LinuxQuestions.org
Review your favorite Linux distribution.
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 11-02-2003, 12:24 AM   #1
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Rep: Reputation: 15
Question Cannot Change File Permission


I am trying to compile a program, and I need to modify the Makefile. However, I cannot modify the Makefile using emacs, because it keeps saying that the Makefile is READONLY. I have changed the permission using 'chmod 777 Makefile', but somehow this does not have an effect (the 'ls' command show that the Makefile is writable after I did the chmod).

Help please? Thanks
 
Old 11-02-2003, 01:17 AM   #2
frosty man
LQ Newbie
 
Registered: Aug 2003
Location: us
Distribution: mandrake 9.1
Posts: 7

Rep: Reputation: 0
Greetings,
Log in as root, check your user groups for your primary login id and add/subtract groups you need/don't need. Then check the ownership of the file, make sure you have access to it as main user. Log in as yourself and whack away.
 
Old 11-02-2003, 02:10 AM   #3
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Original Poster
Rep: Reputation: 15
Frosty man, thanks for your reply.
The file is owned by root, and even though I logged in as root, I am still unable to modify the file. I must have missed something here, it's kind of weird that I was able to play with the file permission but not able to modify it.

Thanks once again.
 
Old 11-02-2003, 02:11 AM   #4
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Also see if you can edit the file as root. File permissions should be irrelevant for root. If you're trying to rename, delete, copy or move the file then the directory permissions come in to play.

Another thing, could you post the ouput of ls -l for that file.
 
Old 11-02-2003, 02:42 AM   #5
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Original Poster
Rep: Reputation: 15
Below is the snapshot of the ls output

[root@localhost Release]# chmod 777 Makefile
[root@localhost Release]# ls -l
total 48
drwxrwx--- 2 3527 3527 4096 Apr 23 1993 bin
-r--r----- 1 3527 3527 161 Feb 4 1993 Bugs
drwxrwx--- 2 3527 3527 4096 Apr 23 1993 data
drwxrwx--- 2 3527 3527 4096 Jul 29 1993 doc
drwxrwx--- 20 3527 3527 4096 Mar 1 1993 examples
drwxrwx--- 2 3527 3527 4096 Feb 18 1993 help
-rwxrwxrwx 1 3527 3527 4267 Feb 19 1993 Makefile
-r--r----- 1 3527 3527 865 Feb 4 1993 README
drwxrwx--- 2 3527 3527 4096 Feb 18 1993 SCCS
drwxrwx--- 24 3527 3527 4096 Apr 23 1993 src
-rwxr-x--- 1 3527 3527 254 Feb 4 1993 suprem4gs
[root@localhost Release]# emacs Makefile

How do you find out if you can edit a file? It looks like the 'rwx' there for all owner, group, and others. I don't know why '3527' is there instead of 'root'. Does the way I un-tar the file matter?

Thanks a lot.
 
Old 11-02-2003, 07:28 AM   #6
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Tar can keep permissions. So whatever permissions they tarred it with might be what you un-tar it with. It's weird that you can't change it even as root. The only thing I can think of is that a process is using it and hence blocking it. But why would that be for a makefile? I dunno. Something's definetly wrong when root can't edit a file because it's read only. You can try changing the ownership to root or whatever else. Though I can't imagine why that would help since permissions SHOULD be irrelevant for root. Weird. Have you tried deleting it and extracting it again?
 
Old 11-02-2003, 10:34 AM   #7
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
The file permissions are 777 so you set them to 777 with chmod.

The ownership is showing that way because the person creating the files had this ID. Your system does not have it so you see an ID number.

You can change all the files ownership

chown -R root.users /path/to/folder

or

chown root.users filename


This is if you have a users group assigned to the user you are wanting to use. You could use a group that limits use.

You do not want to use 777, use 770, or 750 and set a group ownership

Last edited by DavidPhillips; 11-02-2003 at 10:36 AM.
 
Old 11-02-2003, 02:28 PM   #8
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks for all the reply,
I've tried delete the file, even the tar-file, and download it again from the internet, still I was unable to edit. I've changed the ownership also, still didn't work. I'm just going to leave it alone for right now, and get back to it again later.

Anyway, thanks once again.
 
Old 11-02-2003, 05:00 PM   #9
Tom Bozack
LQ Newbie
 
Registered: Dec 2000
Location: Ridgecrest, California
Posts: 25

Rep: Reputation: 15
See if the file attributes are set to prevent the file from being modified. To do this use the command:

lsattr <file name>

The result should look like this

------------- ./<file name>

It the reslut looks something like this

----i-------- ./<file name>

the file cannot be modified or deleted.

To fix this, become root and use the following command:

chattr -i <file name>

For more information do a man on lsattr and chattr.

Tom
 
Old 11-02-2003, 09:29 PM   #10
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Original Poster
Rep: Reputation: 15
Hi all, it turned out that the problem I have was related to emacs. I used other text editor, and I was able to edit the file. Why does emacs prohibit me from editing? I don't know. Anybody knows?
 
Old 11-02-2003, 11:04 PM   #11
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Rep: Reputation: 30
who are running emacs?
root or another user?
 
Old 11-03-2003, 01:01 PM   #12
dsuratman
Member
 
Registered: Nov 2003
Location: CA, USA
Distribution: Ubuntu 7.10
Posts: 31

Original Poster
Rep: Reputation: 15
I was logged in as a root and running emacs. I was not able to edit the Makefile.
 
Old 11-03-2003, 02:47 PM   #13
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Rep: Reputation: 30
Then, i don't understand...:-|

I think that with Midnight you can see if there're something else, but at this moment I don't have idea
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to change the file permission ?? AK prince Slackware 17 08-05-2005 01:16 PM
using chmod to change file permission kiwidoc Linux - Newbie 3 07-25-2004 07:39 AM
chmod 755 won't change file permission. duffboygrim Linux - General 11 04-29-2004 07:17 PM
File permission display and change in GCC Lord CyKill Programming 1 09-26-2003 08:33 AM
cp command change the file permission? myunicom Linux - General 6 09-24-2003 09:15 AM


All times are GMT -5. The time now is 03:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration