Knowledge Base
The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides

|
Enabling SSH for non-root users in ESXi 4.x (2005626)
Symptoms
- Cannot connect to the ESXi 4.x host as a non-root user using SSH
- Connecting to the ESXi 4.x host as a non-root user using SSH fails
- You see the error:
login as: username
username@x.x.x.x's password:
Access denied
Purpose
Resolution
To enable SSH access for non-root users:
- Create a user account on the ESXi 4.x host using one of these methods:
-
- Using the vSphere Client
- Connect to the host directly using the vSphere Client with root credentials.
- Click the Local Users & Groups tab.
- Right-click and click Add.
- Enter a log in name and password.
- Click OK.
- Using the useradd command
Note: Remember to set a password for this user account.
-
- Connect to the host via SSH with root credentials.
- Run this command
mkdir -p /home/username
- Create the user using this command:
useradd test -d /home/username -s /bin/ash
- Using the vSphere Client
- Connect to the host directly using the vSphere Client with root credentials.
- Click the Permissions tab.
- Right-click Add Permission.
- Click Add.
- Select the newly created local user from the list and click Add.
- Assign the Administrator role to the user and click OK.
- When connected to the host via SSH as root:
-
- Take a backup of the /etc/passwd file.
- Verify if the user's /home/username directory exists. If not, create it with this command:
mkdir -p /home/<username>
- Edit the /etc/passwd file and locate the new user account you created:
Note: In ESXi 4.1, by default, the new user account is created with the shell set to /sbin/nologin. In ESXi 4.0 it is set to /bin/false.
- Set the shell to /bin/ash.
- Set the /home directory to the user's /home/username directory.
- Save and quit the file.
- Run this command to restart the inetd service:
services.sh restart
Request a Product Feature
To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.
Actions
KB:
- Updated:
- Categories:
- Languages:
- Product Family:
- Product(s):
- Product Version(s):

