0

I am trying to change the group of a file that I (user123) am an owner of but I am getting an error. It won't let me change the directory permissions, either. It keeps saying the file system is read-only. I don't understand why it won't let me change permissions of a directory of which I am the owner!

(user123) @ subdomain.example.org [/dev/sudo/app/prog/id]
$ ls -la
total 3
drwxr-sr-x 2 user app 1024 Jun 18 11:12 etc

(user123) @ subdomain.example.org [/dev/sudo/app/prog/id]
$ chgrp mygroup etc/
chgrp: changing group of `etc/': Read-only file system

migrated from stackoverflow.com Aug 20 '13 at 19:08

This question came from our site for professional and enthusiast programmers.

  • 5
    It tells you why. The filesystem is mounted readonly. Re-mount it RW and then chgrp. – jtravaglini Aug 19 '13 at 16:09
  • Exactly. It's not that you don't have permission to change it, it's that the thing has been mounted as read only so it can't store new owner information. – Vicky Aug 19 '13 at 16:11
  • That makes sense! I didn't mount this before. What's the command to re-mount? – stevengfowler Aug 19 '13 at 16:12
  • Well, you'll need to use mount on its own to find out how the file system was mounted. Then you run umount /dev/whatever to unmount it; then you run mount ...options except -o ro... /dev/whatever to (re)mount it. All done as root, probably. This is the low-level way to do it; there may be a better, high-level way to do it. – Jonathan Leffler Aug 19 '13 at 16:16
1

It's strange that your root directory is mounted read-only. Was your system started normally or were there any "glitches" during boot? What runlevel are you at? (who -r if you're not sure)

In any case, you can remount the root directory read-write using

mount -o remount,rw /

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy