Sponsored Content
Top Forums Shell Programming and Scripting Need to track what Commands run in a login session Post 303022496 by hb00 on Sunday 2nd of September 2018 03:34:25 AM
Old 09-02-2018
Need to track what Commands run in a login session

Hi

I need to track what commands run in login session in solaris whether it is root or any normal users in bash shell.

My actual requirement is that when a user (nomal/root) login into the system, whatever commands he run, it should log into file on specified path . I don't require command outputs. I want that in a below format.


<date and time of command run> <Actual command run along with it argument>

As I am novice in shell script, please help me in creating the same. I don't want to use snoopy or any other tool due to some constraints just want to use script for implementing the same

Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

User login session

Having a problem on AIX 4.3.3 with the following error when more than 2 users try and sign onto the server. 3004-312 All available login sessions are in use. ???? (1 Reply)
Discussion started by: Docboyeee
1 Replies

2. UNIX for Dummies Questions & Answers

run commands before login

What would be the best way to setup for a Linux box to run a few commands before the user logs in? (1 Reply)
Discussion started by: woofie
1 Replies

3. Programming

keep track of the last 10 commands the user typed

Can I do it like this? if (strcmp(argv, "history")==0) { argv = "10"; execvp(argc,argv); } actually, it doesn't work, How can I modify it? Thanks (17 Replies)
Discussion started by: zhshqzyc
17 Replies

4. UNIX for Dummies Questions & Answers

Possible to track FTP user last login? Last and Finger don't track them.

Like the topic says, does anyone know if it is possible to check to see when an FTP only user has logged in? Because the shell is /bin/false and they are only using FTP to access the system doing a "finger" or "last" it says they have never logged in. Is there a way to see when ftp users log in... (1 Reply)
Discussion started by: LordJezo
1 Replies

5. Solaris

I am not able to login in gnome session and java session in Sun solaris 9& 10

I am not able to login in gnome session and java session in Sun solaris 9& 10 respectively through xmanager as a nis user, I am able to login in common desktop , but gnome session its not allowing , when I have given login credentials, its coming back to login screen, what shoul I do to allow nis... (0 Replies)
Discussion started by: durgaprasadr13
0 Replies

6. Shell Programming and Scripting

Record login session...

How to record my login session in a file named session.lst? (1 Reply)
Discussion started by: anupdas
1 Replies

7. UNIX for Advanced & Expert Users

Track user commands

Hi, I have a unix server and I am concerned about the security on that server. I would like to be able to write a script that records all the commands that were typed at the command prompt before the user calls the 'history -c' command and deletes all the history. I was thinking about firing or... (7 Replies)
Discussion started by: mishkamima
7 Replies

8. Shell Programming and Scripting

Determining if session is a login session

Besides 'who am i' and 'tty' what commands could be used to determine if a session is interactive as compared to a web process or cron process. Any command should work with the common unix variants. (3 Replies)
Discussion started by: jgt
3 Replies

9. AIX

track commands run as root after sudo

I'm looking for a way to track commands that are run as root after a user runs sudo su - root. I have a profile set up for root that will track the commands by userid but if we change the shell it only stores it in that shells history file. (2 Replies)
Discussion started by: toor13
2 Replies

10. Solaris

Run automated bash commands from sh login shell

I use plink.exe to automate remote commands that return data to Windows machines. This works well on newer servers running Red Hat since the commands were developed for bash and the designated user's login shell is bash. I need to also support older servers which are running Solaris 10 but the... (5 Replies)
Discussion started by: randman1
5 Replies
GIT-SHELL(1)							    Git Manual							      GIT-SHELL(1)

NAME
       git-shell - Restricted login shell for Git-only SSH access

SYNOPSIS
       chsh -s $(command -v git-shell) <user>
       git clone <user>@localhost:/path/to/repo.git
       ssh <user>@localhost

DESCRIPTION
       This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing
       the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user's home directory.

COMMANDS
       git shell accepts the following commands after the -c option:

       git receive-pack <argument>, git upload-pack <argument>, git upload-archive <argument>
	   Call the corresponding server-side command to support the client's git push, git fetch, or git archive --remote request.

       cvs server
	   Imitate a CVS server. See git-cvsserver(1).

       If a ~/git-shell-commands directory is present, git shell will also handle other, custom commands by running "git-shell-commands/<command>
       <arguments>" from the user's home directory.

INTERACTIVE USE
       By default, the commands above can be executed only with the -c option; the shell is not interactive.

       If a ~/git-shell-commands directory is present, git shell can also be run interactively (with no arguments). If a help command is present
       in the git-shell-commands directory, it is run to provide the user with an overview of allowed actions. Then a "git> " prompt is presented
       at which one can enter any of the commands from the git-shell-commands directory, or exit to close the connection.

       Generally this mode is used as an administrative interface to allow users to list repositories they have access to, create, delete, or
       rename repositories, or change repository descriptions and permissions.

       If a no-interactive-login command exists, then it is run and the interactive shell is aborted.

EXAMPLE
       To disable interactive logins, displaying a greeting instead:

	   $ chsh -s /usr/bin/git-shell
	   $ mkdir $HOME/git-shell-commands
	   $ cat >$HOME/git-shell-commands/no-interactive-login <<EOF
	   #!/bin/sh
	   printf '%s
' "Hi $USER! You've successfully authenticated, but I do not"
	   printf '%s
' "provide interactive shell access."
	   exit 128
	   EOF
	   $ chmod +x $HOME/git-shell-commands/no-interactive-login

       To enable git-cvsserver access (which should generally have the no-interactive-login example above as a prerequisite, as creating the
       git-shell-commands directory allows interactive logins):

	   $ cat >$HOME/git-shell-commands/cvs <<EOF
	   if ! test $# = 1 && test "$1" = "server"
	   then
		   echo >&2 "git-cvsserver only handles "server""
		   exit 1
	   fi
	   exec git cvsserver server
	   EOF
	   $ chmod +x $HOME/git-shell-commands/cvs

SEE ALSO
       ssh(1), git-daemon(1), contrib/git-shell-commands/README

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							      GIT-SHELL(1)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy