Sponsored Content
Full Discussion: improve sulog
Operating Systems AIX improve sulog Post 302514754 by sparcguy on Monday 18th of April 2011 12:10:57 AM
Old 04-18-2011
improve sulog

I just wrote a very small script that improves readability on system sulog. The problem with all sulog is there is lack of clarity whether the info you are looking at is the most current. So if you just need a simple soution instead of going thru the trouble of writing a script that rotate logs and figure out number of days on the time stamp or install a program to do it, just grep on the fly for what is important that you want like ???-root or ???-oracle and append the system timestamp into the sulog for historical future references.

Code:
while true
do
  TODAY=`date`
  LASTROOT=`tail -1 ./sulog | grep "\-root" > /tmp/testroot`
  if [[ -s /tmp/testroot ]] then
    echo "found :- `tail -1 ./sulog`" | mailx -s "list of users su - root" sparcguy@admin.com
    echo $TODAY >> ./sulog
  else
    echo "not found"
  fi
  sleep 1
done


Last edited by Scott; 04-18-2011 at 02:53 AM..
This User Gave Thanks to sparcguy For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can I improve this script ???

Hi all, Still a newbie and learning as I go ... as you do :) Have created this script to report on disc usage and I've just included the ChkSpace function this morning. It's the first time I've read a file (line-by-bloody-line) and would like to know if I can improve this script ? FYI - I... (11 Replies)
Discussion started by: Cameron
11 Replies

2. UNIX for Dummies Questions & Answers

sulog

Hello, the sulog file on solaris does not record the user's attempts. do i have to delete and create a new one or there is a better way? in addition on the current sulog file is shown the month/day of the user's attempt but i like to see the year also. there is a way to see the year or more... (2 Replies)
Discussion started by: grep
2 Replies

3. Shell Programming and Scripting

improve this?

Wrote this script to find the date x days before or after today. Is there any way that this script can be speeded up or otherwise improved? #!/usr/bin/sh check_done() { if then daysofmth=31 elif then if ... (11 Replies)
Discussion started by: blowtorch
11 Replies

4. UNIX for Dummies Questions & Answers

Improve Performance

hi someone tell me which ways i can improve disk I/O and system process performance.kindly refer some commands so i can do it on my test machine.thanks, Mazhar (2 Replies)
Discussion started by: mazhar99
2 Replies

5. Solaris

How to select last 7 days entry from SULOG or LAST command

Hi All, I need to get last 7 days log entries from sulog. The same has to be done for the last command. for ex: when i search for a user "abc" in sulog, i only want to check his entries for the last 1 week. The same has to be done for last command. Can anyone suggest some tips. ... (0 Replies)
Discussion started by: navdeepan
0 Replies

6. Linux

SULOG for LINUX

How to enable sulog activity in LINUX like /var/adm/sulog in Solaris , AIX..... I have added SULOG_FILE /var/log/sulog in /etc/login.defs ...but it is not working ... Thanks a lot for help (1 Reply)
Discussion started by: Anu_1
1 Replies

7. Solaris

hostname or ip information on sulog

Hi, more than one user login the our solaris 10 systems with same user account by using ssh connection. i wanna see ip or hostname information of them on sulog instead of it's terminal number. is this possible? current sulog is like that SU 02/06 08:59 + pts/1 operation-vuser SU 02/07 14:27... (1 Reply)
Discussion started by: sdkbjk
1 Replies

8. Solaris

/var/adm/sulog does not showing year

Hi, I would like to know is there any way to capture the year in /var/adm/sulog file in solaris 10? Please suggest (2 Replies)
Discussion started by: manoj.solaris
2 Replies

9. Shell Programming and Scripting

How to improve an script?

Gents. I have 2 different scripts for the same purpose: raw2csv_1 Script raw2csv_1 finish the process in less that 1 minute raw2csv_2 Script raw2csv_2 finish the process in more that 6 minutes. Can you please check if there is any option to improve the raw2csv_2. To finish the job... (4 Replies)
Discussion started by: jiam912
4 Replies

10. AIX

Unable to set ACLs on sulog - need to grant read permission to a normal user on AIX 6.1

Hi, I need to grant read permission to a normal user on sulog file on AIX 6.1. As root I did acledit sulog and aclget shows "extended permissions" as "enabled" and normal user "splunk" has read permissions. When I try to access sulog as splunk user it won't allow and aclget for splunk user... (6 Replies)
Discussion started by: prvnrk
6 Replies
su(1M)							  System Administration Commands						    su(1M)

NAME
su - become superuser or another user SYNOPSIS
su [-] [username [arg...]] DESCRIPTION
The su command allows one to become another user without logging off or to assume a role. The default user name is root (superuser). To use su, the appropriate password must be supplied (unless the invoker is already root). If the password is correct, su creates a new shell process that has the real and effective user ID, group IDs, and supplementary group list set to those of the specified username. Additionally, the new shell's project ID is set to the default project ID of the specified user. See getdefaultproj(3PROJECT), setpro- ject(3PROJECT). The new shell will be the shell specified in the shell field of username's password file entry (see passwd(4)). If no shell is specified, /usr/bin/sh is used (see sh(1)). If superuser privilege is requested and the shell for the superuser cannot be invoked using exec(2), /sbin/sh is used as a fallback. To return to normal user ID privileges, type an EOF character (CTRL-D) to exit the new shell. Any additional arguments given on the command line are passed to the new shell. When using programs such as sh, an arg of the form -c string executes string using the shell and an arg of -r gives the user a restricted shell. To create a login environment, the command "su -" does the following: o In addition to what is already propagated, the LC* and LANG environment variables from the specified user's environment are also propagated. o Propagate TZ from the user's environment. If TZ is not found in the user's environment, su uses the TZ value from the TIMEZONE parameter found in /etc/default/login. o Set MAIL to /var/mail/new_user. If the first argument to su is a dash (-), the environment will be changed to what would be expected if the user actually logged in as the specified user. Otherwise, the environment is passed along, with the exception of $PATH, which is controlled by PATH and SUPATH in /etc/default/su. All attempts to become another user using su are logged in the log file /var/adm/sulog (see sulog(4)). SECURITY
su uses pam(3PAM) with the service name su for authentication, account management, and credential establishment. EXAMPLES
Example 1 Becoming User bin While Retaining Your Previously Exported Environment To become user bin while retaining your previously exported environment, execute: example% su bin Example 2 Becoming User bin and Changing to bin's Login Environment To become user bin but change the environment to what would be expected if bin had originally logged in, execute: example% su - bin Example 3 Executing command with user bin's Environment and Permissions To execute command with the temporary environment and permissions of user bin, type: example% su - bin -c "command args" ENVIRONMENT VARIABLES
Variables with LD_ prefix are removed for security reasons. Thus, su bin will not retain previously exported variables with LD_ prefix while becoming user bin. If any of the LC_* variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY) (see environ(5)) are not set in the environment, the operational behavior of su for each corresponding locale category is determined by the value of the LANG environment vari- able. If LC_ALL is set, its contents are used to override both the LANG and the other LC_* variables. If none of the above variables are set in the environment, the "C" (U.S. style) locale determines how su behaves. LC_CTYPE Determines how su handles characters. When LC_CTYPE is set to a valid value, su can display and handle text and filenames containing valid characters for that locale. su can display and handle Extended Unix Code (EUC) characters where any indi- vidual character can be 1, 2, or 3 bytes wide. su can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid. LC_MESSAGES Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English). FILES
$HOME/.profile user's login commands for sh and ksh /etc/passwd system's password file /etc/profile system-wide sh and ksh login commands /var/adm/sulog log file /etc/default/su the default parameters in this file are: SULOG If defined, all attempts to su to another user are logged in the indicated file. CONSOLE If defined, all attempts to su to root are logged on the console. PATH Default path. (/usr/bin:) SUPATH Default path for a user invoking su to root. (/usr/sbin:/usr/bin) SYSLOG Determines whether the syslog(3C) LOG_AUTH facility should be used to log all su attempts. LOG_NOTICE mes- sages are generated for su's to root, LOG_INFO messages are generated for su's to other users, and LOG_CRIT messages are generated for failed su attempts. /etc/default/login the default parameters in this file are: TIMEZONE Sets the TZ environment variable of the shell. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), env(1), ksh(1), login(1), roles(1), sh(1), syslogd(1M), exec(2), getdefaultproj(3PROJECT), setproject(3PROJECT), pam(3PAM), pam_authenticate(3PAM), pam_acct_mgmt(3PAM), pam_setcred(3PAM), pam.conf(4), passwd(4), profile(4), sulog(4), syslog(3C), attributes(5), environ(5) SunOS 5.11 26 Feb 2004 su(1M)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy