Giter Site home page Giter Site logo

Comments (6)

matthchr avatar matthchr commented on July 1, 2024

@rupertnash sorry for the slow response on this -- do you mean that you want the ability to specify a different account for the coordination commandline and the normal commandline?

If all you want is to control both, you can use CloudTask.UserIdentity to do it. See the documentation here for C#

from azure-batch-samples.

rupertnash avatar rupertnash commented on July 1, 2024

@matthchr - sorry Matt, I'm afraid I don't follow (possibly as I've never used C#) how that allows me to set the coordination command to run as a different user.

AFAIK, you set the multi-instance settings on an instance of azure.batch.models.MultiInstanceSettings - allowed attributes are: coordination_command_line, number_of_instances, common_resource_files (note nothing about which user account to use).

Then you give this to the multi_instance_settings attribute of your azure.batch.models.TaskAddParameter, along with a suitable user_identity object.

For now I am just running my tasks an administrator and prefacing the task's command line with sudo -u _azbatch, which is pretty disgusting.

from azure-batch-samples.

matthchr avatar matthchr commented on July 1, 2024

Hey @rupertnash - Sorry, I didn't realize you were using Python (I would've given snippets in that language if I had).

In Python, to configure the user the task runs under, you need to set:
azure.batch.models.TaskAddParameter.user_identity - you can read more about this parameter on readthedocs.

So basically you would set both the multi_instance_settings attribute of TaskAddParameter and the user_identity attribute as well. user_identity applies to the whole task and will run both the multi_instance_settings.coordination_command_line and the command_line in the user you request (or if you don't want to name a user/etc you can use an AutoUser which basically means we generate a user for you but with the criteria you specify.

from azure-batch-samples.

rupertnash avatar rupertnash commented on July 1, 2024

Hi Matt,

So basically you would set both the multi_instance_settings attribute of TaskAddParameter and the user_identity attribute as well. user_identity applies to the whole task and will run both the multi_instance_settings.coordination_command_line and the command_line in the user you request (or if you don't want to name a user/etc you can use an AutoUser which basically means we generate a user for you but with the criteria you specify.

Yes, this is what I said. I'm well aware that Batch will run both commands as the user specified - this is my problem.

I want to run my task as the default non-privileged user (_azbatch ) and the coordination command as a user with admin rights. The reason is that I have a trusted coordination command (necessary to arrange the shared filesystem) and an untrusted user command.

from azure-batch-samples.

matthchr avatar matthchr commented on July 1, 2024

I see - in that case we don't currently support that scenario other than by having you manually sudo like you're doing in the coordination command.

I'll ask around and see if we have any plans to implement this and get back to you.

from azure-batch-samples.

matthchr avatar matthchr commented on July 1, 2024

I've moved this issue to Azure/Batch#12.

from azure-batch-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.