Operating System - HP-UX
1837165 Members
3118 Online
110112 Solutions
New Discussion

Re: User cant shutdown the server

 
SOLVED
Go to solution
Leon Shen
Frequent Advisor

User cant shutdown the server

Hi Experts,

Currently successfull migration from D350 to rp2470 for customer. All the applications are test ok on rp2470. Just have 2 problems need some helps.

1. On the old D350, customer have write a script which allow non-unix skill people shutdown the server during administrator not around. Of course there was user call shutdown in /home. I did copy /etc/hosts and /etc/profile and /home from D350 to rp2470. But when customer test the script and it seem cant shutdown the server and the error mesg show:

shutdown cannot be run from a mounted file system --existing shutdown--
change directory to the root volume ("/" will work) and try again.

I guess something do with the profile. here is the profile for user - shutdown

# script for PBS operators by phuah @ 30.8.93
# modified for KDU @ 29.7.95
# modified for Carrier @ 10.4.96
# modified for In-house use @ 07.08.96
# modified for Lonpac Singapore use @ 3.1.97

# disable interrupt, quit & termination
set -u
trap "echo 'Bye......'" 0
trap 'echo Hey! That is not allowed!!!!' 2 3 15

# enable std keyboarding
# stty line 1 erase '^H' kill '^U' intr '^C' echoe
stty erase "^H" kill "^U" intr "^C" eof "^D"

PATH=/usr/sbin:$PATH:/sbin:/home/shutdown

# default editor variable
EDITOR=vi
export EDITOR

# evaluate and set term type for proper screen clearing
# echo 'TERM=(vt100) \c'
# read TERM
# TERM=vt100
# export TERM
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval `tset -s -Q `
fi
clear

# the actual menu driven operation
while true
do clear
echo " "
echo " "
echo " -------------------------------------------------------------------"
echo " "
echo " # #### # # ##### ## ####"
echo " # # # ## # # # # # # #"
echo " # # # # # # # # # # #"
echo " # # # # # # ##### ###### #"
echo " # # # # ## # # # # #"
echo " ###### #### # # # # # #### S'PORE SHUTDOWN MENU"
echo " "
echo " -------------------------------------------------------------------"
echo " "
echo " [ 1 ] SHUTDOWN SERVER"
echo " "
echo " [ 2 ] ACTIVE USERS"
echo " "
echo " [ lo ] LOGOUT"
echo " "
echo " -------------------------------------------------------------------"
echo " "
echo " Please enter your choice"
read responce
case "$responce" in
"chan") sh
;;
"") continue
;;
"1") echo "Option 1 was selected"
/usr/sbin/sync;sync
/sbin/shutdown -h -y 0
echo "."
echo "Press ENTER to continue"
read dummy
;;
"2") echo "Option 2 was selected"
who
echo "."
echo "Press ENTER to continue"
read dummy
;;
"lo") echo "Option to logout was selected"
break
;;
*) echo "Huh???? That option doesn't exist!"
echo "."
echo "Press ENTER to continue"
read dummy
;;
esac
done
exit 0
#
# that's all there is to it!
#

2) If the superuser(root) change the normal user become root user, on which log can capacture all the details from, such as record the all the command he key in.

Best regards
Leon
8 REPLIES 8
Robert-Jan Goossens
Honored Contributor

Re: User cant shutdown the server

Hi Leon,

Quick question, did you have a /etc/shutdown.allow file on your old server ?

Regards,
Robert-Jan
T G Manikandan
Honored Contributor
Solution

Re: User cant shutdown the server

Just do a small change for option1 as below
Just insert "cd /" changing to root directory.


"1") echo "Option 1 was selected"
cd /
/usr/sbin/sync;sync
/sbin/shutdown -h -y 0
echo "."
echo "Press ENTER to continue"
read dummy
Leon Shen
Frequent Advisor

Re: User cant shutdown the server

Hi Robert,

Yes the old server have the /etc/shutdown.allow this file and I do remember i copy also.

regards
Leon
Peter Godron
Honored Contributor

Re: User cant shutdown the server

Leon,
the disk the user is trying to run the shutdown from is not root.
For a correct shutdown best go to the root partition (/) and then issue the shutdown command.
Q2. Can you please clarify?
You want to know how to log the commands after a normal users uses the su command?
The .history file would track the commands.

Regards
Leon Shen
Frequent Advisor

Re: User cant shutdown the server

Hi Peter,

1) I understood and i will add cd / in the .profile.

2) I mean the normal user's access become root access and does all the command he type will capture in /home/user/.history ?

regards
Leon
Pete Randall
Outstanding Contributor

Re: User cant shutdown the server

Leon,

No - not in the .profile! That would cause the user to be placed in the root directory every time they log in. Put the "cd /" into option 1 of the script as TG suggested.


Pete

Pete
Leon Shen
Frequent Advisor

Re: User cant shutdown the server

Hi Peter,

I mean put the "cd /" into option 1 of the .profile which i post out early under /home/shutdown/.profile. Hope I can got this time right.

regards
Leon
Peter Godron
Honored Contributor

Re: User cant shutdown the server

Leon,
Q2: When the user switches with su the last command in the users history file would be the su command. All commands executed as root would be logged in roots history file (if set up!). When the user exits su the logging switches back to his user file.
Regards