You can get the last login time from the user attributes instead of relying on your last log (we roll ours monthly). This should work but it requires perl to be installed to translate the results into a date and time you can understand:
You can read the users from your /etc/passwd file in a loop:
The result will look similar to this:
Quote:
root Thu Mar 15 10:16:48 2018
daemon Thu Mar 15 10:20:01 2018
bin Thu Mar 15 10:20:01 2018
sys Thu Mar 15 10:20:01 2018
adm Thu Mar 15 10:20:01 2018
uucp Thu Mar 15 10:20:01 2018
guest Thu Mar 15 10:20:01 2018
nobody Thu Mar 15 10:20:02 2018
lpd Thu Mar 15 10:20:02 2018
...
Now that I see it, it may not be accurate for system accounts, but it has been working fine for our individual user accounts. You would have to either grep out your user accounts or "egrep -v" your system accounts.
I created a user, i login as a root. I add him in the group where he can access and login as a root! I checked it in users' list and in group's list, he is there. My problem is this, I cant login using the username/account I just created! What should i do to use and login the user/account i've just... (5 Replies)
I want to delete any file in unix file system which is older then a week.
Those files should not be unix system file..means it should be user created file.
Any clue to this ??
ASAP.
Thanks. (2 Replies)
I need a script to figure out if a user's last login was 90 days or older. OS=AIX 5.3, shell=Korn
Here's what I have so far:
====
#!/usr/bin/ksh
NOW=`lsuser -a time_last_login root | awk -F= '{ print $2 }'`
(( LAST_LOGIN_TIME = 0 ))
(( DIFF = $NOW - $LAST_LOGIN_TIME ))
lsuser -a... (3 Replies)
Hi,
My requirement is that i am login from ROOT in a script but when any
command is coming which is logging to sqlplus then i have to run it with normal user as only normal user have permission to connect to sqlplus .
i tried making a script like this :
#! /bin/ksh
su -... (3 Replies)
Hi all..
I was trying to do a little shell script, that would list users and their login times, lets say like last 5 days.
But I couldnt figure out how to count users login times from previous days. Any tips?
Funny that nobody has do this kinda script before, or atleast I couldnt find on... (2 Replies)
Hello World ~
HW : SUN Fire V240
OS : Solaris 8
Error message prompts 'rmclomv ... SC login failure ...' on terminal.
and
Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S)
The System is in normal operation, though
In case of rain, Can... (1 Reply)
Hi Every body,
I would need a shell script program to login as different user and perform some copy commands in the script.
example: Supppose ora_toms is the active user
ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands
... (9 Replies)
I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs.
I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
now i have logged in username : ramesh in unix
Now i have to created script file to login into another user and have run a command inside that user and after executing the command i have to exit from that user.
Inside script, i have to login into su - ram along with password : haihow and have to... (4 Replies)
Hi Experts,
Need your support
Redhat 6.5
I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login
to perform any task. (10 Replies)
Discussion started by: as7951
10 Replies
LEARN ABOUT PHP
iconv_mime_decode_headers
ICONV_MIME_DECODE_HEADERS(3) 1 ICONV_MIME_DECODE_HEADERS(3)iconv_mime_decode_headers - Decodes multiple MIMEheader fields at onceSYNOPSIS
array iconv_mime_decode_headers (string $encoded_headers, [int $mode], [string $charset = ini_get("iconv.internal_encoding")])
DESCRIPTION
Decodes multiple MIME header fields at once.
PARAMETERS
o $encoded_headers
- The encoded headers, as a string.
o $mode
-$mode determines the behaviour in the event iconv_mime_decode_headers(3) encounters a malformed MIME header field. You can spec-
ify any combination of the following bitmasks.
Bitmasks acceptable to iconv_mime_decode_headers(3)
+------+--------------------------------------+---+
|Value | | |
| | | |
| | Constant | |
| | | |
| | Description | |
| | | |
+------+--------------------------------------+---+
| 1 | | |
| | | |
| | ICONV_MIME_DECODE_STRICT | |
| | | |
| | If set, the given header is decoded | |
| | in full conformance with the stan- | |
| | dards defined in RFC2047. This | |
| | option is disabled by default | |
| | because there are a lot of broken | |
| | mail user agents that don't follow | |
| | the specification and don't produce | |
| | correct MIME headers. | |
| | | |
| 2 | | |
| | | |
| | ICONV_MIME_DECODE_CONTINUE_ON_ERROR | |
| | | |
| | If set, iconv_mime_decode_head- | |
| | ers(3) attempts to ignore any gram- | |
| | matical errors and continue to | |
| | process a given header. | |
| | | |
+------+--------------------------------------+---+
o $charset
- The optional $charset parameter specifies the character set to represent the result by. If omitted, iconv.internal_encoding will
be used.
RETURN VALUES
Returns an associative array that holds a whole set of MIME header fields specified by $encoded_headers on success, or FALSE if an error
occurs during the decoding.
Each key of the return value represents an individual field name and the corresponding element represents a field value. If more than one
field of the same name are present, iconv_mime_decode_headers(3) automatically incorporates them into a numerically indexed array in the
order of occurrence.
EXAMPLES
Example #1
iconv_mime_decode_headers(3) example
<?php
$headers_string = <<<EOF
Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=
To: example@example.com
Date: Thu, 1 Jan 1970 00:00:00 +0000
Message-Id: <example@example.com>
Received: from localhost (localhost [127.0.0.1]) by localhost
with SMTP id example for <example@example.com>;
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
(envelope-from example-return-0000-example=example.com@example.com)
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
EOF;
$headers = iconv_mime_decode_headers($headers_string, 0, "ISO-8859-1");
print_r($headers);
?>
The above example will output:
Array
(
[Subject] => Prufung Prufung
[To] => example@example.com
[Date] => Thu, 1 Jan 1970 00:00:00 +0000
[Message-Id] => <example@example.com>
[Received] => Array
(
[0] => from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)
[1] => (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
)
)
SEE ALSO iconv_mime_decode(3), mb_decode_mimeheader(3), imap_mime_header_decode(3), imap_base64(3), imap_qprint(3).
PHP Documentation Group ICONV_MIME_DECODE_HEADERS(3)