Tuesday, March 17, 2009

ESXi ssh and non-root users

Original Post

I’ve never seen this before. I wrote an article about root SSH access to a ESXi system. Today I noticed a blog entry that describes how you can disable root access for SSH and create users which can use “su” to become root! Cool stuff.

Check the article here! Here’s the procedure:

1. Log in to the console,
2. edit the inetd.conf:

vi /etc/inetd.conf

3. search for the following line (type: “/ssh”) (This is the line you uncommented to enable SSH in the first place.)

ssh stream tcp nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i

4. add -w to the end of this line: (type: “i” for insert mode):

ssh stream tcp nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -w

5. Exit and save the file (press escape, type “: x”)
6. Create a /home directory

mkdir /home

7. Create a new unprivileged user:

useradd your_name

8. Change the password for this user:

passwd your_name

9. The file or sub-dir on / dir which you created will be deleted everytime you reboot!

So, I succeed like this way.

tar cvf home.tar /home
mv home.tar /opt

edit /etc/rc.local bottom line
tar xvf /opt/home.tar -C /

10. Reboot the server

reboot

11. Once rebooted,
Log in with SSH using your new unprivileged user
12. Use

su -

to change to the root user.

Tested on:
VMware ESXi 3.5.0_Update_2-103909


No comments:

Post a Comment