Add capability for creating a sustained shell #67375
Replies: 16 comments
-
People want PAM process e.g. ulimits set. Which su does. |
Beta Was this translation helpful? Give feedback.
-
For flavor, have a look at #51005 and maybe some of the referenced code. Faster/lighter is obviously better than slower/heavier all other things equal, but the semantic of "run this command as this user" can be tricky to get right in a platform independent way without resorting to su. There's a significant different between "run this command with some specific UID" and "run this command as this user." The latter implies things sourcing shell initialization files to create the right environment, getting the right resource limits, etc. |
Beta Was this translation helpful? Give feedback.
-
I am of the opinion that if the state is relying on how the minion happens to initialise the shell login environment for a particular user then that's incorrect. Anything like that should be explictly specified in salt, or you lose the repeatablility/minion independence. And if everything is specified you don't need to perform unnecessary tasks (like starting a load of systemd --user services). A different approach could be to (somehow) keep the |
Beta Was this translation helpful? Give feedback.
-
People want to run commands and have the users path, and limits and application settings. And that fair for them to want things this way. |
Beta Was this translation helpful? Give feedback.
-
In the case of cmd.run for example, I think it's important to note we're not providing a list of arguments to exec -- we're providing a literal string to be evaluated by the shell. For that reason, the least surprising behavior is for the command to be run in exactly the same was as when run by the appropriate user from a login shell. The opportunities for optimization which stand out for me are to (1) provide a state that is a thinner wrapper around exec and (2) keep a login shell around in a sub-process for potentially running more than one command. |
Beta Was this translation helpful? Give feedback.
-
@saltstack/team-core Thoughts? |
Beta Was this translation helpful? Give feedback.
-
For Setting |
Beta Was this translation helpful? Give feedback.
-
I don't have in-depth knowledge here, yet, but my impression is that It also seems like we want to have an alternative approach that tools like postgres can use to avoid all that extra overhead. So maybe this issue should be something like "Create alternative to su" or "Create long-lived su" or something? |
Beta Was this translation helpful? Give feedback.
-
I think that how we use su currently is good, but I also think that it would make sense to add the ability to create a sustained shell. That way the su switch only needs to happen once and the shell can be kept in |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
runas could support values like su:username, proc:username, sudo:username The Lot of people complain that limits.conf was not being applied which su fixed..e.g. increased file limits |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Beta Was this translation helpful? Give feedback.
-
@saltstack/team-core is there a decision on whether there should be any additions/changes here? |
Beta Was this translation helpful? Give feedback.
-
Thank you for updating this issue. It is no longer marked as stale. |
Beta Was this translation helpful? Give feedback.
-
@OrangeDog I've updated the title to bring it in line with Tom's suggestion. That seems like enough information to get someone started. |
Beta Was this translation helpful? Give feedback.
-
Presumably a persistent login shell is only a thing when Salt is being used in a master/minion configuration. I use salt exclusively via I'm still partial to dividing use cases into an |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
From Tom's reply:
Original post:
Using
su
to implementrunas
can waste quite a lot of time as a full user session is initialised, and every command for every state is run independently. I'm noticing this particularly when using the postgres states.Is it feasible to (perhaps configurably) prefer
sudo
(without-i
) or even a fork-and-setuid instead, for a lightweight solution.Beta Was this translation helpful? Give feedback.
All reactions