Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: General discussion of protected file editing, not a need for help.

  1. #1
    Join Date
    Mar 2007
    Location
    Crofton, Maryland, USA
    Beans
    Hidden!

    General discussion of protected file editing, not a need for help.

    Just let me start by saying I don't need technical help. I'm looking for a discussion and comments.

    I just finished a short "help me" thread on editing the grub.cfg file. The first reply I received simply pointed out the first few lines of that file (grub.cfg) which states:

    #
    # DO NOT EDIT THIS FILE
    #

    First, I was frustrated that I couldn't edit the file, even though I was using:
    Code:
    sudo gedit grub.cfg
    What I received when I tried to save the file was a message saying it was in a write-protected disk and I couldn't save it.

    Second, I thought this went against the concept of Linux, meaning the user has total control. Am I reading this wrong? Yes, it's possible that I might screw up the file. But that's the point of Linux. You make a mistake (perhaps a really big one), but then you learn from that.

  2. #2
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: General discussion of protected file editing, not a need for help.

    The messages you got just means, that you don't know enough to screw up your system yet . Just because you tried to edit the file as root, and it wouldn't let you save your changes, doesn't mean it is impossible to do so. I would suggest you learn about permissions and give it a try again.

  3. #3
    Join Date
    Jun 2008
    Location
    Colombia
    Beans
    443

    Re: General discussion of protected file editing, not a need for help.

    Yes, it's a simple matter of permissions. However the grub.cfg file gives you alternatives in case you really want to change it's behaviour.
    Code:
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by /usr/sbin/grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: General discussion of protected file editing, not a need for help.

    Quote Originally Posted by gsparky2004 View Post
    Second, I thought this went against the concept of Linux, meaning the user has total control. Am I reading this wrong? Yes, it's possible that I might screw up the file. But that's the point of Linux. You make a mistake (perhaps a really big one), but then you learn from that.
    Root has total control. You have to choose the right tool for the job.

  5. #5
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: General discussion of protected file editing, not a need for help.

    Quote Originally Posted by gsparky2004 View Post
    Just let me start by saying I don't need technical help. I'm looking for a discussion and comments.

    I just finished a short "help me" thread on editing the grub.cfg file. The first reply I received simply pointed out the first few lines of that file (grub.cfg) which states:

    #
    # DO NOT EDIT THIS FILE
    #

    First, I was frustrated that I couldn't edit the file, even though I was using:
    Code:
    sudo gedit grub.cfg
    What I received when I tried to save the file was a message saying it was in a write-protected disk and I couldn't save it.

    Second, I thought this went against the concept of Linux, meaning the user has total control. Am I reading this wrong? Yes, it's possible that I might screw up the file. But that's the point of Linux. You make a mistake (perhaps a really big one), but then you learn from that.
    You should use gksu with graphical apps such as gedit

    The second issue is "security", it is a feature.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  6. #6
    Join Date
    Jan 2008
    Beans
    438

    Re: General discussion of protected file editing, not a need for help.

    You can't edit grub.cfg because it doesn't have write permission set. You can set write permission on it with root, but there's a reason it's set this way. Grub.cfg is regenerated using data from many extra config files every time the system is updated. If you put your changes straight into grub.cfg, they'll just be lost on the next update. You need to put your changes into the files that are used to generate grub.cfg in the first place.

    Quote Originally Posted by bodhi.zazen View Post
    You should use gksu with graphical apps such as gedit
    If you're already in a terminal, sudo works just as well. Gksu was made for those situations you're not already on a command line, and there is no standard input to read from (like for menu shortcuts). Actually, if you're in a terminal and launching a graphical program, I'd recommend using sudo with the -b option ("sudo -b gedit"), which backgrounds the launched task so you can continue using the terminal after the task is started.

  7. #7
    Join Date
    Dec 2006
    Beans
    1,133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: General discussion of protected file editing, not a need for help.

    You could not edit the file with gedit because by design, it is difficult to hose your system with a gui tool. You need the cli for that!
    There are no dumb questions, just dumb answers.

  8. #8
    Join Date
    Dec 2006
    Beans
    1,133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: General discussion of protected file editing, not a need for help.

    Quote Originally Posted by Agent ME View Post
    ...
    If you're already in a terminal, sudo works just as well. Gksu was made for those situations you're not already on a command line...
    gksudo (or gksu) is recommended (rather than sudo) to run a gui program as root regardless of whether it is started in a terminal or not. One reason being that using sudo instead makes it easier to inadvertently give root ownership to files in your home directory.
    There are no dumb questions, just dumb answers.

  9. #9
    Join Date
    Jan 2008
    Beans
    438

    Re: General discussion of protected file editing, not a need for help.

    Quote Originally Posted by lswb View Post
    gksudo (or gksu) is recommended (rather than sudo) to run a gui program as root regardless of whether it is started in a terminal or not. One reason being that using sudo instead makes it easier to inadvertently give root ownership to files in your home directory.
    From the man page for gksu, it looks like it uses the same mechanism as su/sudo for elevating privileges.

    And I just did a quick test. "sudo -b xterm","touch test-sudo" and "gksu xterm &","touch test-gksu" both create the the file owned by root inside my home directory. I can't find any difference between su/sudo and gksu/gksudo besides different options that can be passed on the command line. They also start xterm with identical environment variables.
    Last edited by Agent ME; December 16th, 2009 at 05:01 AM.

  10. #10
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: General discussion of protected file editing, not a need for help.

    Quote Originally Posted by Agent ME View Post
    From the man page for gksu, it looks like it uses the same mechanism as su/sudo for elevating privileges.

    And I just did a quick test. "sudo -b xterm","touch test-sudo" and "gksu xterm &","touch test-gksu" both create the the file owned by root inside my home directory. I can't find any difference between su/sudo and gksu/gksudo besides different options that can be passed on the command line. They also start xterm with identical environment variables.
    http://psychocats.net/ubuntu/graphicalsudo

    Code:
    man gksu
    
     --preserve-env, -k
    
                  Preserve the current environments, does not set $HOME nor $PATH,
                  for example.
    --preserve-env is not default, that means that gksu resets the $HOME environment by default while sudo doesn't.

    Code:
    sudo gnome-terminal
    then run:
    Code:
    echo $HOME
    and

    Code:
    gksu gnome-terminal
    then run:
    Code:
    echo $HOME
    Last edited by sisco311; December 16th, 2009 at 05:07 AM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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