Solaris History

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Solaris History
# 1  
Old 01-11-2018
Solaris History

why in solaris 10 I do not get history when I have the role as root?

Code:
computer.root > history

I get history:not found

I am in
Code:
computer.root > echo $SHELL

Code:
/bin/sh

computer.root >

how can I see roots history in the sh shell?

but in other shells I can only see my history and no one elses who I able to su - root?
# 2  
Old 01-11-2018
I cannot tell what you are doing. So, let's try this as root user:

You are going to enter 4 commands EXACTLY, then when the last command completes, you will enter an ESC-K (escape key - K)
Code:
EDITOR=/usr/bin/vi
export EDITOR
ls 
bar

The last command should give you an error - not found. OK, so now we test "history"
Press ESC-k - you should see "bar"
Press ESC-k again - you should see "ls" appear on the command line - if you hit return it runs the ls command.

We just turned on history, I think. So, there should now be a history file in root's home directory.

It is a hidden file - meaning it starts with the . character IRC the file is named .history
Code:
ls -la .history

should list the file if you are in your home directory.
# 3  
Old 01-11-2018
Oh. And this shows you how to get what you want,I think, which is nothing like what I think your are trying:
sudo - make sudoers use their own history file - Unix & Linux Stack Exchange

This is a bash example, so be careful.
# 4  
Old 01-11-2018
/bin/sh is an old Bourne shell.
No history, no job control.
If you want history you should switch to bash (or zsh)
Code:
exec /bin/bash

Or permanently change root's login from /sbin/sh to /bin/bash with
Code:
passwd -e root

After changing the login shell, before you leave the current shell, test with another (parallel) login!
These 2 Users Gave Thanks to MadeInGermany For This Post:
# 5  
Old 01-11-2018
I fully subscribe to the comment above. Solaris comes with an archaic bourne shell.
This User Gave Thanks to dodona For This Post:
# 6  
Old 01-13-2018
Code:
mserver.root > ls -la .history

.history: No such file or directory

---------- Post updated at 06:33 PM ---------- Previous update was at 06:32 PM ----------

I am trying to find out what others are doing as root, but since they use /sbin/sh,i guess that I am out of luck
# 7  
Old 01-13-2018
Hi,

Basically, yes.

However, there is one more thing that may be worth checking. If your Solaris system has accounting enabled, then you might be able to run lastcomm to see the commands executed by users on the system. If this is enabled (and it's not enabled by default), then it will only show you very basic information - just the name of the command and none of the arguments, along with who ran it and when. But it's better than nothing, and could be worth a try before you give up. Note that if it's not enabled then enabling it now won't give you any historical data - it will only log commands from the point of activation onwards.

But really, as previously noted, for proper history logging all users who you want logged will have to use another shell, such as Bash.
These 2 Users Gave Thanks to drysdalk For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

View 30 days history of freemem Solaris 10

I need to bump up the memory allocated to an Oracle database running on Solaris 10. While I see there is currently plenty of free memory to spare, how do I view the history of free memory on Solaris over the last month? What is the exact command? ---------- Post updated at 02:55 PM ----------... (0 Replies)
Discussion started by: mimimiami
0 Replies

2. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

3. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

4. Solaris

solaris 10 reboot history

Dears Kindly am requested to collect the date histroy that the system was rebooted, so is there any log file or command that i can find the time that the system was rebooted? thanks a lot for you kind support. (2 Replies)
Discussion started by: thehero
2 Replies

5. UNIX for Advanced & Expert Users

history timestamp in Solaris

Anyone knows how to display timestamp in Solaris since "HISTIMEFORMAT" variable is not supported in ksh ? (2 Replies)
Discussion started by: linuxgeek
2 Replies

6. UNIX for Advanced & Expert Users

Solaris shutdown and boot history

Hello. I'm trying to get a Solaris (SunOS 5.10) shutdown and boot history. Unfortunately the /var/adm/wtmpx file does not cover the period I want to trace. It's been reset. Therefore the command, "last" (or "last reboot") does not reach back far enough. Additionally the /var/adm/messages*... (4 Replies)
Discussion started by: etlpkby
4 Replies

7. Solaris

How to set history key in Solaris

Hi Solaris guys, I just have my solaris 10 setup on x86 old box... How can i get history key? eg. Linux using up/down arrow key to call history command... HPUX using Esc-k How can i do the samething in Solaris? Thanks in advanced! Regards, gary (3 Replies)
Discussion started by: timontt
3 Replies

8. Solaris

solaris 10 vi history

i got solaris 10 DVD and i install it on intel 64. how do i set history to vi for command line? i can use backup space as well, it goes with "^H". this won't work, export EDITOR=vi, it response with not an identifier. thanks itik (4 Replies)
Discussion started by: itik
4 Replies

9. Solaris

Command history in Solaris

Can someone tell me what I can do to maintain a single history file ? As it is it creates a new file for each session. >ls -a .sh_* .sh_history.10106 .sh_history.15240 .sh_history.21635 .sh_history.4291 .sh_history.11311 .sh_history.16593 .sh_history.23709 .sh_history.4661... (3 Replies)
Discussion started by: jxh461
3 Replies

10. Solaris

Passwd History in Solaris 8

How to set passwd history feature in Solaris 8 to stop users from using their old passwords? (4 Replies)
Discussion started by: amoorti
4 Replies
Login or Register to Ask a Question