change "who" command output
Hi all
Is it possible to change the who command otput. The output of who command in my box is: khairil@serverwarkom:~$ who khairil :0 2002-01-03 01:01 root pts/1 2007-07-24 19:32 (152.118.99.49) It says that there is 2 user online. Khairil and root. We can also conclude that khairil connect locally and root connect remotely from IP 152.118.99.49. Is it possible to change the output of the command. For example the output will be khairil@serverwarkom:~$ who khairil :0 2002-01-03 01:01 root :0 2007-07-24 19:32 or something similar thet do not tell any user where is the root connect from. |
As a quick and dirty fix, you could alias "who" to "who -q".
Code:
alias who='who -q' You'll have to apply this globally to affect your users. |
alisaisng who
Thanks rocket 357.
It'sa good solution. Is there enaything else that will work? |
Good solution, except that if anybody checks what "who" actually does, it's revealed that it's an alias and then if anybody just used
Code:
which who Code:
/bin/who A slightly more complex option would be to wrap the actual 'who' into a script so that regular users could not start 'who', but could start the script that started 'who -q' - the original 'who' would of course be moved to another place, and this script put into it's place, so people would run the script by typing 'who' and not the actual 'who'. Shortly: script in place of real 'who', that runs 'who -q' from someplace else - with users forbidden to use the original executable from where ever it is. |
You could try doing something like this:
who | sed -e 's/pts\/[0-9]\{1,\}/:0/' This should replace pts/* with :0. You may also want to check out the commands "w" and "finger" and "last". These commands may also contain the terminal information that you are trying to hide. --Shaun |
Thanks
Thank you all. I'll combine b0uncer and binary_pearl tips.
I think that's the solution i need. |
All times are GMT -5. The time now is 06:49 AM. |