I don't understand what is owner of process. Owner of bash is me. Then who is owner of init and xterm? I searched on google but I can't find.
Processes normally have a user and group id they run at, processes that are started with
root permission (user id 0), can change the id they are running with (e.g. your webserver can run as user www-data).
During startup initial user id is 0, for something that is started by a logged in user it is (in most cases) the id of the user.
So you do not really own those processes, they run with your id, and that allows you to kill them etc. The ids of a process also determine what directories can be accessed and which files changed/created.
Processes have lineages just like people. So in the same way people have parents, so do processes. If you look at the output of
ps you can see who owns a particular process.
$ ps -eaf | head -10 UID PID PPID C STIME TTY TIME CMD root 1 0 0 Dec07 ? 00:00:07 /usr/lib/systemd/systemd --system --deserialize 24 root 2 0 0 Dec07 ? 00:00:00 [kthreadd] root 3 2 0 Dec07 ? 00:00:03 [ksoftirqd/0] root 5 2 0 Dec07 ? 00:00:00 [kworker/0:0H] root 7 2 0 Dec07 ? 00:00:00 [kworker/u:0H] root 8 2 0 Dec07 ? 00:00:06 [migration/0] root 9 2 0 Dec07 ? 00:00:00 [rcu_bh] root 10 2 0 Dec07 ? 00:00:56 [rcu_sched] root 11 2 0 Dec07 ? 00:00:00 [watchdog/0]
The 1st column is the user that owns the process. The 2nd column is the process ID (PID) assigned to that process. And the 3rd column is the parent process ID (PPID). This PPID is what chains a process to a previous process, so in effect the PPID is the parent process ID for a particular process.
These are examples of processes that are other users (besides root) that have PPID's of processes owned by user root.
Owned by user avahi:
avahi 511 1 0 Dec07 ? 00:00:00 avahi-daemon: running [greeneggs.local]
Owned by user dbus:
dbus 512 1 0 Dec07 ? 00:00:22 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
Here we can see where a process started by a process owned by root eventually spans a process owned by my username
root 1266 547 0 Dec07 ? 00:00:00 gdm-session-worker [pam/gdm-password] saml 1277 1266 0 Dec07 ? 00:00:03 gnome-session
Notice that gnome-session's PPID is 1277.
Lastly you can use slightly different switches to
ps to see a visual tree of lineage.
$ ps -auxf root 530 0.0 0.0 296804 1824 ? Ssl Dec07 0:00 /usr/sbin/gdm root 547 0.0 0.0 380436 2208 ? Sl Dec07 0:00 \_ /usr/libexec/gdm-simple-slave --display-id /org/gnome/Dis root 584 4.0 0.5 297980 40816 tty1 Ss+ Dec07 86:37 \_ /usr/bin/Xorg :0 -background none -verbose -auth /run root 1266 0.0 0.0 516956 3160 ? Sl Dec07 0:00 \_ gdm-session-worker [pam/gdm-password] saml 1277 0.0 0.0 714828 6336 ? Ssl Dec07 0:03 \_ gnome-session
Each process runs as a particular user. (It's called “user”, not “owner”.) The user determines the processes's rights. In particular, if a process is running as the user
sumi, then whenever that process tries to access a file, the “user” permissions on that file apply (first rwx group of the
ls -l output, first digit of the octal mode).
A number of things are restricted to processes running as the same user, such as sending signals (killing) and obtaining debugging information.
All the processes that you interact with directly — shell, terminal emulator, browser, etc. — run as your user.
The user that a process is running as is unrelated to the user who owns the disk file containing the program. Most programs are installed system-wide and owned by root, but when the program is executed, the process runs as the user who started it.
init process, like other core system processes, runs as the system user, root. The root user has more rights than other users.
(This is to get you started. I've simplified several aspects of process users, privileges and file access rights.)