Results 1 to 4 of 4

Thread: [SOLVED] How to edit a file in treminal

  1. #1
    Join Date
    May 2008
    Beans
    19

    [SOLVED] How to edit a file in treminal

    I have this file vsftpd.conf; for vsftpd...But when i edit the file using gedit it gives me an error "This file can be only written by root.U don have enuf permisions"


    Something to do with sudo/chmod.... Please help and even if i execute sudo gedit vsftpd.conf
    then wrie something for the file in the terminal itself??? Please elaborate... I'm new to linux

  2. #2
    Join Date
    Oct 2007
    Location
    ISS
    Beans
    1,429

    Re: How to edit a file in treminal

    Press Alt+F2 and

    Code:
    gksudo gedit /path_to_the_file/filename
    Or in the terminal try

    Code:
    sudo nano /path_to_the_file/filename
    In order to use a program as root use gksudo in graphical environments and sudo in the terminal.

    You press Alt+F2 and

    Code:
    gksudo nautilus
    to browse your filesystem as root.
    Last edited by Vivaldi Gloria; June 21st, 2008 at 12:08 PM. Reason: more info

  3. #3
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to edit a file in treminal

    Quote Originally Posted by harsh_ View Post
    I have this file vsftpd.conf; for vsftpd...But when i edit the file using gedit it gives me an error "This file can be only written by root.U don have enuf permisions"


    Something to do with sudo/chmod.... Please help and even if i execute sudo gedit vsftpd.conf
    then wrie something for the file in the terminal itself??? Please elaborate... I'm new to linux
    When you receive a message like that it means that you are trying to edit a system file or a file owned by another user. You don't normally have permission to change those files. However, you can temporarily gain permission to edit these files by assuming administrative powers.

    You do this with the sudo command. Open your text editor with the following command. I use gedit, but you may use nano, vi, etc. For graphical applications, 'gksudo' is preferred over 'sudo'.
    Code:
    gksudo gedit /path/filename
    It will ask for a password. Enter your password. You will not see anything but it will be registered. Hit enter and you should now be able to edit the file.
    Last edited by drs305; June 21st, 2008 at 12:10 PM. Reason: gksudo

  4. #4
    Join Date
    Jul 2005
    Location
    England
    Beans
    Hidden!

    Re: How to edit a file in treminal

    To read more about sudo and its advantages and disadvantages go here.

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
  •