LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I tell and change what user runs what program? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-tell-and-change-what-user-runs-what-program-509884/)

flycast 12-12-2006 08:49 PM

How can I tell and change what user runs what program?
 
I have two questions:

1) I have a user called backuppc. Files that are owned by backuppc show up as "backuppc - BackupPC" on the properties window (debian). I have looked at Users and have seen that there is a field called "Name" that has "BackupPC" in it. Is the files that says "backuppc - BacklupPC" really owned by "backuppc" or by "backuppc - BackupPC"?

2) How do I tell what user runs what program when the programs start automatically at boot or by a cron? Once I find this then how do I change it?

matthewg42 12-12-2006 09:42 PM

Quote:

Originally Posted by flycast
I have two questions:

1) I have a user called backuppc. Files that are owned by backuppc show up as "backuppc - BackupPC" on the properties window (debian). I have looked at Users and have seen that there is a field called "Name" that has "BackupPC" in it. Is the files that says "backuppc - BacklupPC" really owned by "backuppc" or by "backuppc - BackupPC"?

Which application shows this - nautilus (the file manager in the gnome desktop), konqueror (the file manager in the KDE desktop), or something else?

Quote:

Originally Posted by flycast
2) How do I tell what user runs what program when the programs start automatically at boot or by a cron? Once I find this then how do I change it?

Programs started by the sysvinit system run as root, but some daemons may start processes as other users. e.g. the postgres database usually runs it's daemon processes under the postgres user.

Cron has two main ways to launch jobs. Scripts copied to the /etc/cron.daily, /etc/cron.weekly, ... directories are executed as root. Again switching to another user may be done, but this is something the job itself must implement.

The second cron mechanism, is the user level crontabs. Each user who is permitted to, can have a crontab file (in my debian install these are stored in /var/spool/cron/crontabs/). These files are created and edited from the user account with the "crontab -e" command. These are executed as the user whose crontab it is.

pixellany 12-12-2006 10:06 PM

Open a terminal and do "ls -l" You will see two name associated with every file and directory. The first is the user who owns the file, and the second is the group it is assigned to. Only the owner (and root) can change the file properties.

To control who can run what, you will typically work with group assignments and permissions.
Quick example:
-rwxr-xr-x 1 root root 5239 2006-10-10 23:57 firefox
Here, everyone is allowed to run the file
Now, change it to this:
-rwxr-xr-- 1 root surfers 5239 2006-10-10 23:57 firefox
Now it can only be run by the owner (root) and any member of the "surfers" group. Add Fred to surfers and now he can run this file.

For more details: man chmod, man chown, plus all the man pages on adding users and groups.


All times are GMT -5. The time now is 02:34 PM.