Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting a script with root login

Status
Not open for further replies.

Popol357

Technical User
Mar 12, 2002
1
CA
Hi there,

In some occasions, I need to give my root login to our system. I change first my password and then I have this line in the .login in order to track what they are doing :

script -a /var/tmp/script.$$.log; logout;

The problem is when they log on, this command is echoed on the screen and they delete the first before logging out.

Is there is a way to get this command issued without having any text echoed at the beginning and the end ? I tried redirecting to null without success.

Thanks

PA
 
I don't know of a way to do exactly what you want, but have you considered putting the script command within another script with a meaningless name, so that the path to the log file isn't echoed to the screen. If it works, at least this might make it harder for the miscreants. Hope this helps.
 
If you get your idea to work, please be sure and post it here. I am interested in what you are trying to do. Thanks. -Bobby s-)
bwgunn@icqmail.com
 
If you're just trying to track the commands used by the users logged in, you could reset the HISTFILE variable, to reflect each separate login...

i.e.

export HISTFILE=.sh_history.$$

Then periodically clean out any old history files...

Another thing you could do, is create an "su" account for those users who need root access, then set the HISTFILE to it's default of .sh_history, in .profile...

Each "super-user" account will then have it's own history file...

Depending on how large you want the history file to be, you can set the size of the history file, so that it automatically removes OLD lines in excess of what you've specified...

i.e.

export HISTSIZE=500

So, in the .profile, or /etc/profile, the entries would look like this:

export HISTFILE=.sh_history
export HISTSIZE=500 #Or 1000, or whatever you want.

Hope this helps,

Joe F.
 
This is a little off from your question, but you can install "sudo" on your system.. Using sudo can allow your users to run a command as any user without giving out root password. It is very customizable. It will be easier for you to monitor who runs that specific command if you configure it to log everything in syslog. and the main point... nobody has to know root password but you.

Good luck,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top