VMware Cloud Community
hansis
Contributor
Contributor
Jump to solution

create new user - no ssh access

Hello!


I have created a new user with vSphere Client and have grant Shell-Login.

But if I want to connect with ssh I get the message "Access Denied"!

What do I have to do?

thx

hansi

0 Kudos
1 Solution

Accepted Solutions
schepp
Leadership
Leadership
Jump to solution

Hi,

a)

in the /etc/security/access.conf you need to set a line:

+:username:ALL

before the -:ALL:ALL line!

or

b)

add the user to the root-group (usermod -a -G root username)

I would prefer a Smiley Wink

Regards

View solution in original post

0 Kudos
11 Replies
Virtualinfra
Commander
Commander
Jump to solution

Have you tried the steps in following kb, if not please try that.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=837563...

If you have tried and your getting error message, please be clear at what point you get that error and also put a screen shot here.

Award points for the helpful and correct answer by clicking the below tab Smiley Happy

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
schepp
Leadership
Leadership
Jump to solution

Hi,

a)

in the /etc/security/access.conf you need to set a line:

+:username:ALL

before the -:ALL:ALL line!

or

b)

add the user to the root-group (usermod -a -G root username)

I would prefer a Smiley Wink

Regards

0 Kudos
hansis
Contributor
Contributor
Jump to solution

many thanks

only a) I needed

hansi

0 Kudos
abbie11
Enthusiast
Enthusiast
Jump to solution

Hi You can do this in two ways, either using the vSphere Client to connect directly to the host as root – selecting the Local users and group tab and adding your user to the root group, or from the Service Console you can use the command usermod -a G 0 username

_____
Thanks

Winning!
0 Kudos
hansis
Contributor
Contributor
Jump to solution

Hello!

The Login works fine. I didn't add the user "usvuser" to the root-group, because he didn't need root-rights.

Now this user should be able to list and shutdown vms.

vmware-vim-cmd vmsvc/getallvms

But I get following error:

Failed to login: vim.fault.NoPermission

in /etc/sudoers i put following line:

%usvuser ALL=NOPASSWD:/usr/bin/sudo, /bin/bash, /test/test_shutdown_vms.sh, /usr/bin/vim, /usr/bin/vimsh, /usr/bin/vmware-vimsh, /usr/bin/vmware-vim-cmd, /usr/bin/vmware-cmd, /bin/echo, /bin/date, /bin/sed,
/bin/awk

What I have forgotten?

thx.

hansi

0 Kudos
schepp
Leadership
Leadership
Jump to solution

Hi,

maybe you just forgot to write "sudo" in front of the command: "sudo vmware-vim-cmd vmsvc/getallvms"

Or your user "usvuser" is not in the group "usvuser", your entry in the /etc/sudoers gives the rights to the group usvuser and not the user itself. Remove the "%" to make it available to the user.

Regards

0 Kudos
hansis
Contributor
Contributor
Jump to solution

hello again!

My script is ready, but one problem I have:

[usvuser@ATESX1 USV]$ /sbin/shutdown -h now
shutdown: you must be root to do that!

In  /etc/sudoers I have:

usvuser ALL=NOPASSWD:/USV/shutdown_vms.sh, /USV/TEST_shutdown_esx.sh, /USV/TEST_shutdown_vms.sh, /USV/USVonline.txt, /USV/LOGS, /usr/bin/sudo, /bin/bash, /usr/bin/vim, /usr/bin/vimsh$
usvuser localhost=/sbin/shutdown -h now

what do I have to do that the User "usvuser" is able to shutdown the ESX-Host.

thx

--> hansis100 is my new account Smiley Happy

0 Kudos
schepp
Leadership
Leadership
Jump to solution

1 year later... :smileysilly:

well you have to execute it with sudo in front, so:

sudo /sbin/shutdown -h now

you forgot the sudo here:

[usvuser@ATESX1 USV]$ /sbin/shutdown -h now
shutdown: you must be root to do that!

Regards

0 Kudos
hansis
Contributor
Contributor
Jump to solution

Yes one year ago Smiley Happy

thx.

another problem: I have startet the Script with sudo TEST_shutdown.sh

And now I have to put in a password?!?

[usvuser@ATESX1 USV]$ ./TEST_shutdown_esx.sh
Password:

Whats this?

thx

0 Kudos
schepp
Leadership
Leadership
Jump to solution

Try to call the complete path:

"sudo /USV/TEST_shutdown_esx.sh"

0 Kudos
hansis
Contributor
Contributor
Jump to solution

Yeah!

No my script is running Smiley Happy

thx to all

0 Kudos