Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

unable to write into hosts vie ssh - pls help!

Discussion in 'General Discussion' started by c_figer, Oct 18, 2011.

  1. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    not sure what i need to do when hosts file doesnt get written in ??

    im using this command:

    Code:
    nano /etc/hosts
    
    then the content of the file should appear - right?

    well - i get blank zilch nada!!

    then i simply paste the content that is supposed to be in that file and hit ctrl+X then Y and then Enter - well it says that the file was saved then i repeat the above command to see the file again and comes back blank again -

    is there any way to make that file writable - or maybe upload the file manually via root ftp??

    actually i already tried and the filezilla says:

    Error: error while writing: failure
    Error: File transfer failed

    and erases the file on server with the blank file - so its not actually rejecting the manual upload but it overwrites with the blank file of the same name - gush!

    alright then... what should i do to put the file on the server's root ftp so it preserves the content - or what should be typed into ssh command to finally save the revision of the etc/hosts file?

    please accept my appology in advance if this is something you have never heard but i am in fact going thru this ordeal as we speak here: any access via http is down - i can only access my server via sftp or root-ssh -
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,436
    Likes Received:
    416
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What is it that you're hoping to accomplish that you're having an ordeal with?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    trying to write the content of /etc/hosts file into /etc/hosts file via ssh-root this:

     
    #3 c_figer, Oct 18, 2011
    Last edited: Oct 18, 2011
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,436
    Likes Received:
    416
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Not sure why you'd be adding that. Are you logged in as root?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    yes as always - fyi: im the root admin so i always login as root -
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,436
    Likes Received:
    416
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You might like this:
    ConfigServer Explorer

    Free, easy to install and gives you access to the entire file system via your browser.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator

    looking good! but once it is installed, is this only accessible from WHM panel? im asking because as i explained above that i dont have any http access to my server nor accounts nothing because the hosts file is empty - however i have full access to the root-server via ssh-root and sftp client -

    so any help on fixing the hosts file would be appreciated - please help as im running out of options here -
     
    #7 c_figer, Oct 18, 2011
    Last edited: Oct 18, 2011
  8. ruyrocha

    ruyrocha Member

    Joined:
    Oct 12, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Brasil
    What are the results of a lsattr /etc/hosts ?
     
  9. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    ------------- /etc/hosts

    ADDED: i just ran the same command on several other random files in the same directory and they all have dashes for attributes - however by looking at the same files via filezilla, i can see them all have 644 chmod -
     
    #9 c_figer, Oct 18, 2011
    Last edited: Oct 18, 2011
  10. c_figer

    c_figer Member

    Joined:
    Apr 14, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    anyone has anything to pitch in? i cant think of anything else to trigger the etc/hosts file start saving the changes made via ssh -


    some ideas will help too! i just cant sit here with paid non-working dedi and the local forumer who gave me the ssh-commands initially cant even step in and see whats wrong now - i hope he isnt on the permanent vacation....
     
  11. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,896
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Are you able to see the contents of the file when using the "cat" command? EX:

    Code:
    # cat /etc/hosts
    If so, have you tried using another text editor such as "vi"?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice