Find the answer to your Linux question:
Results 1 to 8 of 8

Thread: writing files

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    writing files

    using FC6 to run my new home server. trying to write an script and run it. I use vi to make the script but unable to save the file cause its saying its read only.
    I log in as root so I should have all rights to read and write- right?
    I thought as su - gives me all rights to read & write? I've tried sudo and su - but nothing changes rights

  2. #2
    hey vejan!

    do a chmod on the script you want to run under root for ex:

    #chmod u+x name_of_ur_script

    -makes the script executable

    #chmod u+r/w name_of_ur_script

    -sets read/write permissions

  3. #3
    Linux Newbie PureGrain's Avatar
    Join Date
    Nov 2006
    Mt. Washington, Kentucky
    chmod 755 <filename>

    Should be safe with that.
    LINUX - "The other white meat.."
    Registered Linux User #439112

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    Jan 2007
    If you have problems SAVING the file, it might be you do not have write permissions for the whole directory (in this case chmod <signgle file> doesn't help)

  6. #5
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    No need to change perms if you're using vi as root, just add a bang to the end of wq so :wq! and it will write the file, unless the immutable attribute is set, which I doubt.

  7. #6


    Update- None of the answers provided here have solve my problem
    What am I doing wrong?

    I am the sole operator of this server and always will be so I only made one account- which is root-. Do I need to add a user so I can get use su -?

  8. #7
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon


    If u Login as root and chmod command should work
    If this fails, Apply chmod command for whole directory.
    if that too fails,
    is it you harddisk partition mounted readonly---this is rare case.
    Anyway, Cut n paste your /etc/fstab file content.
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal

  9. #8


    here is my fstab

    /dev/Volgroup / ext3 defaults 1 1
    /boot /boot ext3 defaults 1 2
    devpts /dev/pts devpts gid=5,mode=620 0 0
    tmpfs /dev/shsm tmpfs defaults 0 0
    proc /proc proc defaults 0 0
    sysfs /sysfs sysfs defaults 0 0
    /dev/volgroup swap swap defaults 0 0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts