Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
Hi Everyone another newbie question here, I'm logged on as root and this is the following message that I receive. [root@cj root]# /etc/hosts bash: /etc/hosts: Permission denied [root@cj root]# Any ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Posts
    18

    Root Permissions


    Hi Everyone another newbie question here, I'm logged on as root and this is the following message that I receive.

    [root@cj root]# /etc/hosts
    bash: /etc/hosts: Permission denied
    [root@cj root]#


    Any suggestions how to increase permissions as root? I was under the impression that root usr had all access.

    Regards,
    C.R.

  2. #2
    Linux Engineer
    Join Date
    Aug 2004
    Posts
    826
    That's probably because you're trying to execute /etc/hosts as a command but /etc/hosts is not a command. If you want to read /etc/hosts use less:
    Code:
    less /etc/hosts

  3. #3
    Just Joined!
    Join Date
    Dec 2004
    Location
    Arkansas
    Posts
    11

    Re: Root Permissions

    Quote Originally Posted by dirk2004
    Hi Everyone another newbie question here, I'm logged on as root and this is the following message that I receive.

    [root@cj root]# /etc/hosts
    bash: /etc/hosts: Permission denied
    [root@cj root]#


    Any suggestions how to increase permissions as root? I was under the impression that root usr had all access.

    Regards,
    C.R.
    Perform the following function here:
    cd /etc
    file hosts this will tell you what type of file IE;executable, acsii test etc...
    cat hosts

    Then you can view the contents of the file, using 'file' will be very helpful in knowing what command to use to view contents, install, and so on.


  4. #4
    Linux Enthusiast
    Join Date
    Jun 2004
    Location
    Windsor, CO
    Posts
    656
    You can also use "ls -l" to list the contents of the directory with permission settings attached.
    Root does have full access, but it still follows whether a file is marked as executable or not.
    Emotions are the key to the soul.
    Registered Linux User #375050

  5. #5
    Just Joined!
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    10
    /etc/host is a text file, so use more to see its content and vi to edit.

  6. #6
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817
    I sure don't want to discourage anyone from using the command line, but there are some benefits of the GUI. The file manager (nautilus and others) shows the "file type", which, in the case of /etc/hosts is "plain text document" or something like that. If you open it from the file manager, depending on your settings, it would open the file in a text viewer or an editor. If it was an executable file, again depending on your settings, you could see the executable bit set and double clicking would offer the choice of running the file or opening it in a text viewer or editor. So how do you open the file manager as root after you've logged in as a user? In a console, as root, run nautilus or konqueror or your choice of filemanager. But be careful: root's file manager looks just like to normal users'.
    /IMHO
    //got nothin'
    ///this use to look better

  7. #7
    Just Joined!
    Join Date
    Feb 2005
    Posts
    18
    Thanks everyone for the suggestions. The main reason why I asked the question is because at start up I get the following message:

    "Could not look up internet address for cj. This will prevent GNOME from operating correctly. It may be possible to correct the problem by adding cj to the file /etc/hosts.

    Log in anyway or Try again."

    So any help to this problem would be appreciated.

    Regards,
    C.R.

  8. #8
    Linux Engineer
    Join Date
    Aug 2004
    Posts
    826
    Use any editor to edit the file /etc/hosts (must be done as root) and add "cj" like it says. An excerpt of what you would replace would look like:
    Code:
    localhost locahost.localdomain
    which you'd change to
    Code:
    cj cj.localdomain
    or whatever your domain name is.

  9. #9
    Just Joined!
    Join Date
    Feb 2005
    Posts
    18
    Thanks for the information, however what file editor do you suggest? I also don't know how to open up an editor?

    Any suggestions would be great.

    Thank you.

    C.R.

  10. #10
    Linux User
    Join Date
    Feb 2005
    Posts
    290
    pico is absolutely great for beginner, easy to use, just refer to the menu bar below, e.g. ^X means ctrl-X.

    By the way, vi is the most common editor installed in not only linux but various flavour of unix, but it takes time to get use to it.

    happy leanring

Page 1 of 2 1 2 LastLast

Posting Permissions

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