[BisManLUG] Enabling SSH on VMware ESXi Server without vi

1 view
Skip to first unread message

Dan Falconer

unread,
May 10, 2010, 11:43:22 AM5/10/10
to bismanlug
I have an ESXi server setup, and I'm trying to enable SSH.  All the stuff I've found online [ http://www.google.com/search?hl=en&q=vmware%20esxi%20enable%20ssh&btnG=Search ] wants me to go to the console via Alt+F1 and use "vi" to edit the /etc/inetd.conf file.  Unfortunately, the server either doesn't have that in its path or it is not installed at all.  I can't seem to find any other editor, and "sed" isn't on the server... any thoughts on how to do it?

--
Best Regards,


Dan Falconer
http://www.CrazedSanity.com || http://www.Buzzkill.org

Brent

unread,
May 10, 2010, 1:03:52 PM5/10/10
to BisManLUG
Well, just like the good days when all there was available for editing
was a "line editor". Hmmm, may be that wasn't so great, but it
certainly did force one to learn regular expressions well. Does "ed"
or "ex" exist? "awk" could be used too.

If you only have the console available, copy the file to a usb thumb
drive and then make the edit on another system, then copy it back.

If you are accessing the system in some way through another system
(serial connection) you have a few other options available:
"cat" the file (hopefully it's not too big) to screen, copy it to your
clipboard, make the edit on a local system, then:
cat > newconffile
[paste content]
[enter]
[control-D]

This might give you a double spaced file. If so, you can also edit
the content locally as a "echo" shell script, paste that using the
file create method above, then have the shell script echo out content
and redirect that into your new file.

You could also write a while loop/readline shell script and do the
whole thing in script, but that is a little more painful.

Other things that come to mind would be using "split". You could
literally split the file into a bunch of little files, overwrite the
few lines/files with your new content and then "cat" the files back
together into a new file.

I suppose there are more ways, but hopefully this helps.

Brent

unread,
May 10, 2010, 1:05:09 PM5/10/10
to BisManLUG
If you have network connectivity, you could ftp the file out, edit and
copy back....

Robert Hart

unread,
May 10, 2010, 1:06:02 PM5/10/10
to bism...@googlegroups.com
echo 'your sshd line >> /etc/inetd.conf

Dan Falconer

unread,
May 10, 2010, 1:17:53 PM5/10/10
to bism...@googlegroups.com
Thanks for all the advice.  I hadn't thought of echoing the uncommented line to the bottom of the file... that sounds like the easiest way (other than sending the file to another machine, editing, then sending it back).  Guess we'll call this one closed, unless anyone has any advice on how to install vi onto the ESXi server.

Brent

unread,
May 10, 2010, 1:21:08 PM5/10/10
to BisManLUG
Keep a backup of your file just in case you make a mistake and append
an bogus entry to the file.

Dan Falconer

unread,
May 10, 2010, 1:25:26 PM5/10/10
to bism...@googlegroups.com
Good call, Brent!  I generally make a copy of everything before doing something detrimental, but there's always that one time that I forget... ;)

On Mon, May 10, 2010 at 12:21 PM, Brent <bren...@gmail.com> wrote:
Keep a backup of your file just in case you make a mistake and append
an bogus entry to the file.



Jonathan Ziemann

unread,
May 10, 2010, 2:49:32 PM5/10/10
to bism...@googlegroups.com
I was able to do this successfully under ESXi 4.0 many times.  Here is how I do it:

  • Go to the ESXi console and press alt+F1
  • Type: unsupported
  • Enter the root password(No prompt, typing is blindly)
  • At the prompt type “vi /etc/inetd.conf”
  • Look for the line that starts with “#ssh” (you can search with pressing “/”)
  • Remove the “#” (press the “x” if the cursor is on the character)
  • Save “/etc/inetd.conf” by typing “:wq!”
  • Restart the management service “/sbin/services.sh restart”

Dan Falconer

unread,
May 10, 2010, 3:34:47 PM5/10/10
to bism...@googlegroups.com
FYI: I was able to use vi to edit the file, even though it ("vi") didn't appear to be a valid command.  It all works now.  Thanks for all your input!
Reply all
Reply to author
Forward
0 new messages