Yes, I have tested it here (but only after you asked). I only have one user so it's not a very thorough test case.
Do you get an error, or doesn't it do what you expect?
Where do you want the real name to be displayed?
The sed script is the moral equivalent of grep "^$user:" /etc/passwd | cut -d: -f5 which is arguably more readable. Maybe you want to use that instead, actually.
Last edited by era; 04-28-2008 at 04:42 PM..
Reason: Explanation of and alternative to sed script
Hi All,
I am trying to write a script to list all users and their processes. I cant seem to find out how to link the PID to the user. For example if i run ps -a I get a nice list of all the processes running and their PID, but no information about which user is running them.
If i use w i... (17 Replies)
Hi guys,
I'm writing a script to display all the current logged on users and the processes they're running, output to a file. The output will look similar to this:
User1 (Real name not login name)
PID TTY TIME CMD
3179 pts/3 00:00:00 vim
User2
PID TTY TIME ... (2 Replies)
hello, i am VERY new to this whole script world. I need to come up with a script that will email a user if they have an idle process past 500 minutes...any suggestions??? Thanks so much. (0 Replies)
I am trying to write a script to list all users and their processes. I cant seem to find out how to link the PID to the user. For example if i run ps -a I get a nice list of all the processes running and their PID, but no information about which user is running them. I need the users real name not... (3 Replies)
Thx for all the help so far, I really appreciate it, this is the last task I have to do then I am no longer a trainee ^^, which means I can use whatever utility I want. :O
I need to write a script that does more or less what is shown below.
The Users Name
PID TTY TIME CMD
12345 pts/3... (22 Replies)
Hello All,
Background
========
I am creating a virtual appliance console for a software stack on VMware ESXi. I am using Centos 5.x as the Linux distro (Guest OS). I have created a ncurses based application that does the user authentication and present him with some basic controls to do basic... (2 Replies)
Hello,
What i have to do is make a top 10 list of users sorted by the number of processes opened at a given time. Can anyone help me with finding out for a given moment, for all users how many processes each had opened? (5 Replies)
Is it possible to get a list of users sorted by the number of processes executed by each.
I have a HP - UX server with 2800 processes running currently.
And I want to know the number of processes owned by each person logged in to that server.something like below:
user1 : 150 Processes
user2 :... (2 Replies)
hello,
i need help with something which should be fairly simple but i am having a little trouble.
i need to list all the processes on the system but also need the parent id.
so the following does not print parent id.
ps -A or ps -e.
i searched manual and saw an option
--ppid
so i... (2 Replies)
I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made.
1. The problem statement, all variables and given/known data:
The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies
LEARN ABOUT SUSE
logprof.conf
LOGPROF.CONF(5) AppArmor LOGPROF.CONF(5)NAME
logprof.conf - configuration file for expert options that modify the behavior of the AppArmor logprof(1) program.
DESCRIPTION
The logprof(1) program can be configured to have certain default behavior by the contents of logprof.conf.
The [qualifiers] section lists specific programs that should have a subset of the full ix/px/ux list when asking what mode to execute it
using.
Since creating a separate profile for /bin/bash is dangerous, we can specify that for /bin/bash, only (I)nherit, (U)nconstrained, and
(D)eny should be allowed options and only those will show up in the prompt when we're asking about adding that to a profile.
Likewise, if someone currently exec's /bin/mount in ix or px mode, things won't work, so we can provide only (U)nconstrained and (D)eny as
options.
And certain apps like grep, awk, sed, cp, and mkdir should always inherit the parent profile rather than having their own profile or
running unconfined, so for them we can specify that only (I)nherit and (D)eny are the allowed options.
Any programs that are not listed in the qualifiers section get the full (I)nherit / (P)rofile / (U)nconstrained / (D)eny option set.
If the user is doing something tricky and wants different behavior, they can tweak or remove the corresponding line in the conf file.
The [defaulthat] section lists changehat-aware programs and what hat logprof(1) will collapse the entries to for that program if the user
specifies that the access should be allowed, but should not have it's own hat.
The [globs] section allows modification of the logprof rule engine with respect to globbing suggestions that the user will be prompted
with.
The format of each line is-- "<perl glob> = <apparmor glob>".
When logprof(1) asks about a specific path, if the perl glob matches the path, it replaces the part of the path that matched with the
corresponding apparmor glob and adds it to the list of globbing suggestions.
Lines starting with # are comments and are ignored.
EXAMPLE
[qualifiers]
# things will very likely be painfully broken if bash has it's own profile
/bin/bash = iu
# mount doesn't work if it's confined
/bin/mount = u
# these helper utilities should inherit the parent profile and
# shouldn't have their own profiles
/bin/awk = i
/bin/grep = i
/bin/sed = i
[defaulthat]
/usr/sbin/sshd = EXEC
/usr/sbin/httpd2 = DEFAULT_URI
/usr/sbin/httpd2-prefork = DEFAULT_URI
[globs]
# /foo/bar/lib/libbaz.so -> /foo/bar/lib/lib*
/lib/lib[^/]+so[^/]*$ = /lib/lib*so*
# strip kernel version numbers from kernel module accesses
^/lib/modules/[^/]+/ = /lib/modules/*/
# strip pid numbers from /proc accesses
^/proc/d+/ = /proc/*/
BUGS
None. Please report any you find to bugzilla at <http://bugzilla.novell.com>.
SEE ALSO apparmor(7), apparmor.d(5), enforce(1), change_hat(2), complain(1), logprof(1), genprof(1), and
<http://forge.novell.com/modules/xfmod/project/?apparmor>.
NOVELL /SUSE 2007-04-03 LOGPROF.CONF(5)