unable to write into hosts vie ssh - pls help!

c_figer

Member
Apr 14, 2010
15
0
51
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 -
 

c_figer

Member
Apr 14, 2010
15
0
51
Los Angeles
cPanel Access Level
Root Administrator
You might like this:
ConfigServer Explorer

Free, easy to install and gives you access to the entire file system via your browser.

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 -
 
Last edited:

c_figer

Member
Apr 14, 2010
15
0
51
Los Angeles
cPanel Access Level
Root Administrator
What are the results of a lsattr /etc/hosts ?
------------- /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 -
 
Last edited:

c_figer

Member
Apr 14, 2010
15
0
51
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....
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
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.