• Post Reply Bookmark Topic Watch Topic
  • New Topic

Startup applications runs as which user?  RSS feed

 
Partheban Udayakumar
Ranch Hand
Posts: 499
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to Linux, so this may be a basic doubt. There are applications which start at startup right. How are they executed? As root or as normal users? I wanted to clarify this because I want to run a script as root at startup.
 
Tim Holloway
Saloon Keeper
Posts: 18792
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can. But I don't run as root unless I absolutely must.
 
Partheban Udayakumar
Ranch Hand
Posts: 499
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,

Thanks for the reply. By mistake I pressed Enter, now I have updated the question. Sorry for the inconvenience caused.
 
Tim Holloway
Saloon Keeper
Posts: 18792
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The system startup process has been changing over the last few years and in some cases, has even diverged according to the distro used.

Originally, the basic startup sequence consulted a file named "/etc/inittab" which would spawn several basic processes, including the "getty" processes that listen for terminal input and the rc.sysinit process that acts as the secondary process creator. Finally, there's the runlevel manager which starts and stops the system applications (mostly daemons) that are expected to be operating for a given system runlevel (2 for offline, 3 for online command-line, 5 for full GUI).

This arrangement, stolen from Unix worked well for many years, but it has several disadvantages. For one thing, modern-day systems have a great many service inter-dependencies. You cannot meaningfully start a webapp server unless the network is running, for example. A lot of scripts hacked around these limitations, but it wasn't a very pretty solution. So some newer system service managers have been developed that analyze for these dependencies and attempt to sort them out. At the moment, however, these replacements tend to be pretty ragged and there's no universal standard, so you have to go with whatever manager is incorporated into the particular flavor and version of Linux you want to work with.
 
Tim Holloway
Saloon Keeper
Posts: 18792
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh. And in answer to your question. The system processes are spawned as sub-processes of the root user. Many of the init processes, however, either spawn their daemons under private users in order to reduce security exposure. For example, Apache normally starts as root and then switches to a private user (typically named "apache"). The PostgreSQL database starts under the user ID postgres, using the "su" command to switch user identities.
 
Partheban Udayakumar
Ranch Hand
Posts: 499
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,

Thanks for the clarification. I too researched a bit about init systems. I think you would have seen my question here. I tried running the script from init.d, it worked fine, I am actually fetching the screenshot of the system using the Rectangle class in java, that screenshot isn't transferred when I run the script from init.d. So I thought why not give a try from autostart and attempted it but from here the jar file, isn't running. My jar file needs root access or at least sudo access. So I was wondering if there wasn't enough permission to run the jar. That is why I posted the question here. Is there a way where we can run my jar as sudo or root? If there is a way, please guide me. I am trying this for nearly a month
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!