Run profile script as creator user (not root)

2 views
Skip to first unread message

Ryan W. West

unread,
Oct 28, 2022, 10:58:04 PM10/28/22
to Powder Users
I'm wondering if it's possible to, when running startup scripts through a powder profile, to have those scripts execute as the user that will be logging in once the nodes are ready? Or this might actually come down to detecting the username of said user. 

I'm ultimately trying to put something in their home directory but cannot currently use `$HOME` since that redirects to `/root` when the startup script is run.

I'm also not sure if said user has even been added as an account when the startup scripts are running, so unsure if anything I wrote to their home directory would be overwritten.

Eric Eide

unread,
Oct 29, 2022, 12:34:26 PM10/29/22
to Powder Users
"Ryan W. West" <ryan...@gmail.com> writes:

> I'm wondering if it's possible to, when running startup scripts through a
> powder profile, to have those scripts execute as the user that will be
> logging in once the nodes are ready? Or this might actually come down to
> detecting the username of said user.

You can determine the user name of the experiment's creator with `geni-get`.
For example:

imp:~> geni-get user_urn
urn:publicid:IDN+emulab.net+user+eeide

Assuming that the experiment creator is the user who will eventually login,
you can script what you want.

> I'm also not sure if said user has even been added as an account when the
> startup scripts are running, so unsure if anything I wrote to their home
> directory would be overwritten.

User accounts have been created by then, yes. (I'm 99.9% sure.)

--
-------------------------------------------------------------------------------
Eric Eide <ee...@cs.utah.edu> . University of Utah School of Computing
https://www.cs.utah.edu/~eeide/ . +1 801-585-5512 . Salt Lake City, Utah, USA

Ryan W. West

unread,
Oct 29, 2022, 12:40:50 PM10/29/22
to Powder Users
I did not know that existed. Thank you!
Reply all
Reply to author
Forward
0 new messages