Score:0

How do I run a program when all the rest stopped of my user?

cn flag

I have a ssh-server. I want to have a process executed by a non-root user, after all the other processes are stopped after the user logged out. What bash codes need to be written to start running the program, when all other processes stopped of that user?

I use Ubuntu server 22.04.2

The user with no sudo will do this. It should be runned once. The process should eventually change the name of this user.

ar flag
Does this non-root user have sudo privileges? Does the program need to be run as root? What does the program do? This sounds like [a XY problem](https://en.wikipedia.org/wiki/XY_problem). If you edit your question and explain what you are trying to achieve, w have offer a different solution.
hiddenhospitalresearch avatar
cn flag
no sudo privileges
hiddenhospitalresearch avatar
cn flag
I want to change the username of this user
ar flag
Add all the information in your question. For example, Is this a one-time thing or do you want to do this every time the user logs in and out? Who will do this, you the owner of the ssh-server with sudo or the user with no sudo?
user535733 avatar
cn flag
Doing actions upon logout can be problematic. What if the user doesn't logout but suffers a different type of disconnection? What if the server crashes or loses power? Generally, the developers I know prefer to use login instead (fewer possibilities to go wrong), or to disconnect the action from login/logout entirely.
waltinator avatar
it flag
Please [edit] your question to add whatever new information you have. Don't use Add Comment, or you'll classify yourself as "Does Not Follow Instructions (DNFI)", and I'll ignore you. I view DNFIs as unhelpable.
hiddenhospitalresearch avatar
cn flag
@waltinator I have edited the question
Raffa avatar
jp flag
"all other processes stopped" and "change the name of this user" are not clear … What services(*It can’t possibly be all system services*) and what user name? … Please demonstrate with a clear example … And please tell us why? What are you trying to achieve?
ar flag
I don't think a non-root user (i.e.an user with no sudo rights) can change his/her own username. The user has to be logged out, and another user (with sudo rights) must be logged in to do this.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.