Discussions specific to the VMware vSphere hypervisor
Post Reply
steelnwool
Enthusiast
Posts: 30
Liked: 1 time
Joined: Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald
Contact:

Which user do Linux scripts run as

Post by steelnwool » Jul 15, 2015 6:03 pm

Topic says it all, do linux scripts run as the root user, or as the user that ssh'd in ?

Dima P.
Product Manager
Posts: 10539
Liked: 858 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: Which user do Linux scripts run as

Post by Dima P. » Jul 16, 2015 12:32 am

Jeff,
root should work.

alanbolte
Expert
Posts: 635
Liked: 172 times
Joined: Jun 18, 2012 8:58 pm
Full Name: Alan Bolte
Contact:

Re: Which user do Linux scripts run as

Post by alanbolte » Jul 16, 2015 1:26 am

Are you asking how to set the account for prefreeze/post-thaw scripts? The job will either use the account specified in the main guest processing page of the job settings, or the credentials you set for specific VMs after clicking the "Credentials..." button.

Vitaliy S.
Product Manager
Posts: 23001
Liked: 1557 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Which user do Linux scripts run as

Post by Vitaliy S. » Jul 16, 2015 11:23 am

You can enable native VMware Tools quiescence to execute these pre-freeze/post-thaw scripts as well. Here is a bit more more information about this.

steelnwool
Enthusiast
Posts: 30
Liked: 1 time
Joined: Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald
Contact:

Re: Which user do Linux scripts run as

Post by steelnwool » Jul 16, 2015 12:09 pm

Well, I have it as a non root account that gets elevated via sudo. Which means it logs in as a user name veeam, and then sudos to root.

The part I'm not sure of is if it for pre/post scripts if it gets sudo'd or if it tries to run as vim. I'll just write a script to spit out the effective UID/GID to see what is up.

@Vitaliy S. - Thanks!.

steelnwool
Enthusiast
Posts: 30
Liked: 1 time
Joined: Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald
Contact:

Re: Which user do Linux scripts run as

Post by steelnwool » Jul 16, 2015 1:52 pm

The answer is root

Code: Select all

#!/bin/bash

echo uid is $UID >> /tmp/uid
echo euid is $EUID >> /tmp/uid

exit 0

ssh over to the VM and....

ls -l /tmp/uid
-rw-r--r-- 1 root root 19 Jul 16 09:44 /tmp/uid

cat /tmp/uid
uid is 0
euid is 0
Mind you, the job is still failing with "timed out waiting for script to finish execution" but I'll start another thread on that :)

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests