VMware Cloud Community
CraigH98
Contributor
Contributor

Is it possible to connect with a user other then root?

Using the connect-viserver cmdlet is it possible to connect with a user that does not have root and then subsequent to authentication pass it an su- or sudo to perform commands? It seems when I try this that the authentication fails. I'm not sure what the cmdlet is actually expecting so it's not sure if this will work or not

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

Could you give us a bit more info?

Are you connecting to a VC or an ESX server? I suspect an ESX server.

How did you try to pass the "su -" or "sudo" to the cmdlets?

Perhaps include the relevant lines of your script in this post.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
CraigH98
Contributor
Contributor

Yeah that would probably help.

Basically I'm connecting directly to an esx server (If I connect to a VC the vpxuser takes care of this for me but I was testing somethings and found it easier to concentrate on a single esx server rather then worrying about the cluster or farm....)

so it's pretty easy... if I do a Connect-VIServer servername -User root -Password rootpassword I can then run an Invoke-Expression "x"

but if I run a Connect-VIServer servername -User otheruser -Password otheruserpassword I get a

"Connect-VIServer : Login failed due to a bad username or password."

However if I ssh to that same server through putty and present the same credentials I authenticate just fine.

Reply
0 Kudos
LucD
Leadership
Leadership

There is a difference between loging on to the COS (what you do with putty) and opening a session to the ESX server.

Check if the "otheruser" has any permissions on the ESX server (not the COS).

You can do this by connecting from a VIC to the ESX server and then selecting .

Now you can select the "otheruser" and attribute him a specific role ("administrator" if you want to do changes from that account or "read-only" if you only want to get information from the ESX server with that account).

Note that you can create your own "roles" if needed.

The actual permission to be able to connect to the ESX server is in fact a hidden permission.

For now it should suffice to know that once the "otheruser" is assigned any of the roles he will be able to connect to the ESX server with Connect-ViServer.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos