First, add a soft link from /bin/false to /usr/bin/nologin
Next, have a list of user-names in a text file, one name per line. Then prepare the following script:
Now, it's possible that you will have to add the nologin pseudo-shell to the list of shells that are valid. If it fails for every user, then you'll need to figure out how to add it to the list. The AIX manual says:
Quote:
Valid shells are defined in the usw stanza of the /etc/security/login.cfg file.
You can also instead do this, a very AIX-specific method:
Note, I have not tested this as I don't have access to an AIX host.
I have customers on our AIX/UNIX node startup a process that becomes stranded or orphaned and must be killed. I would like to create a script to check for these orphan processes and kill them. I can have cron run this job. The customers process will run and after 24 hours time out leaving an... (4 Replies)
Hello,
I need to add information in the gecos of each login in the passwd file. I have expect installed. I thought about using expect to to read a file with the login names and the gecos information and then execute the command passwd with the -f option. The other option would be to read... (1 Reply)
I searched the forum rather thoroughly but still could not find the answer. Hopefully the solution is right under my nose.
Here what I need to do, move older data to a Archive folder that is 18 months old and older.
I would like to use the following command,
find departmentx/* -mtime 530... (5 Replies)
I have a small script where I want to see if a file exists & then delete the first line from it.
I have code to help me find if the file exists, but I am unsure as to how to then take in the answer and remove the first line from the flatfile:
This is what I have so far just to output if the... (3 Replies)
Hi all,
I need a script that will loop around all the current processes and take a pmap -x <process id> and output each pmap to a separate file.
Would anyone have a quick command to do this? (2 Replies)
I have a situation where I would like to retrieve a list of ids on AIX 5.3 server, which do not have proper gecos information. The need is to fix all of these ids before it gets flagged as an audit exposure. Can someone please help me with a command/script to retrieve this list?
G (3 Replies)
I would like to extract only the email ids from the gecos of each user id. I have to get the email ids of all the users on the server like this.
Can someone please assist me with the command/script? (15 Replies)
Hi All,
Do you have any sample script,
- auto get file from SFTP remote server and delete file in remove server after downloaded.
- only download specify filename
- auto upload file from local to SFTP remote server and delete local folder file after uploaded
- only upload specify filename
... (3 Replies)
I wish to pull out a list of all user ids on the system, including the privileged ids, the groups to which they belong to. Sometimes after deleting an id also, its home dir does not get deleted or an entry is left behind in /etc/passwd.
Can someone help me with a script to achieve both. (2 Replies)
Discussion started by: ggayathri
2 Replies
LEARN ABOUT OPENSOLARIS
shmids
shmids(2) System Calls shmids(2)NAME
shmids - discover all shared memory identifiers
SYNOPSIS
#include <sys/shm.h>
int shmids(int *buf, uint_t nids, uint_t *pnids);
DESCRIPTION
The shmids() function copies all active shared memory identifiers from the system into the user-defined buffer specified by buf, provided
that the number of such identifiers is not greater than the number of integers the buffer can contain, as specified by nids. If the size
of the buffer is insufficient to contain all of the active shared memory identifiers in the system, none are copied.
Whether or not the size of the buffer is sufficient to contain all of them, the number of active shared memory identifiers in the system is
copied into the unsigned integer pointed to by pnids.
If nids is 0 or less than the number of active shared memory identifiers in the system, buf is ignored.
RETURN VALUES
Upon successful completion, shmids() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The shmids() function will fail if:
EFAULT The buf or pnids argument points to an illegal address.
USAGE
The shmids() function returns a snapshot of all the active shared memory identifiers in the system. More may be added and some may be
removed before they can be used by the caller.
EXAMPLES
Example 1 shmids() example
This is sample C code indicating how to use the shmids() function.
void
examine_shmids()
{
int *ids = NULL;
uint_t nids = 0;
uint_t n;
int i;
for (;;) {
if (shmids(ids, nids, &n) != 0) {
perror("shmids");
exit(1);
}
if (n <= nids) /* we got them all */
break;
/* we need a bigger buffer */
ids = realloc(ids, (nids = n) * sizeof (int));
}
for (i = 0; i < n; i++)
process_shmid(ids[i]);
free(ids);
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ipcrm(1), ipcs(1), Intro(2), shmctl(2), shmget(2), shmop(2), attributes(5)SunOS 5.11 8 Mar 2000 shmids(2)