Which user do Linux scripts run as

VMware specific discussions

Which user do Linux scripts run as

Veeam Logoby steelnwool » Wed 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 ?
steelnwool
Enthusiast
 
Posts: 30
Liked: 1 time
Joined: Fri Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald

Re: Which user do Linux scripts run as

Veeam Logoby Dima P. » Thu Jul 16, 2015 12:32 am

Jeff,
root should work.
Dima P.
Veeam Software
 
Posts: 6261
Liked: 441 times
Joined: Mon Feb 04, 2013 2:07 pm
Location: SPb
Full Name: Dmitry Popov

Re: Which user do Linux scripts run as

Veeam Logoby alanbolte » Thu 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.
alanbolte
Expert
 
Posts: 635
Liked: 170 times
Joined: Mon Jun 18, 2012 8:58 pm
Full Name: Alan Bolte

Re: Which user do Linux scripts run as

Veeam Logoby Vitaliy S. » Thu 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.
Vitaliy S.
Veeam Software
 
Posts: 19570
Liked: 1104 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Which user do Linux scripts run as

Veeam Logoby steelnwool » Thu 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: Fri Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald

Re: Which user do Linux scripts run as

Veeam Logoby steelnwool » Thu 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 :)
steelnwool
Enthusiast
 
Posts: 30
Liked: 1 time
Joined: Fri Sep 03, 2010 4:44 pm
Full Name: Jeff MacDonald


Return to VMware vSphere



Who is online

Users browsing this forum: No registered users and 24 guests