Operating System - HP-UX
1835232 Members
2525 Online
110078 Solutions
New Discussion

Re: automatic system shutdown with user logon

 
Nsikan_1
Advisor

automatic system shutdown with user logon

How do I creat a user such that immediately he/she logon to the system with his name & password,the system shutdown automatically?
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor

Re: automatic system shutdown with user logon

Hi:

Create the user of your choice. This can be done however you wish -- via SAM or with 'useradd' [see the man pages for the same].

In place of the user's shell (the seventh field of '/etc/passwd', specify:

/sbin/shutdown -ry 0

Then, in '/etc/shutdown.allow' add the user name as:

myhostname user_who_can_shutdown

Be sure to have the entry:

myhostname root

...in the '/etc/shutdown.allow' file too!

Regards!

...JRF...
Sandip Ghosh
Honored Contributor

Re: automatic system shutdown with user logon

Create a user with Super User Capability and put the shutdown command in his/her profile.
You can put the shutdown command on the /etc/passwd file against that user also, so that as soon as the user logs in, it will execute the shudown command.

Sandip
Good Luck!!!
Rich Wright
Trusted Contributor

Re: automatic system shutdown with user logon

Why do you want to do this and who do you work for?
David Andrews_1
Advisor

Re: automatic system shutdown with user logon

Small point, but...

'/sbin/shutdown -ry 0' will re-boot the machine.

'/sbin/shutdown -hy 0' will halt the machine after shutting it.

You may want to set up two users, one for each.
Nsikan_1
Advisor

Re: automatic system shutdown with user logon

Hi all,
I've got the solution.
1.create a user using any of sam , useradd,vi /etc/passwd ensuring that the shell is /sbin/shutdown,if using useradd: specify -s /shell/shutdown.

2. edit .profile of that user created and include /sbin/shutdown as part of PATH:,specifically replace /sbin with that.
then below the PATH:.... line,type: /sbin/shutdown -hy 0

3. Save your work with either: wq or x!

logon as that user.it worked for me.
Thanks for all your assistant.
Regards.
Nsikan.
Pete Randall
Outstanding Contributor

Re: automatic system shutdown with user logon

All I can say is you must be really upset with this user. This is almost as bad as the guy who wanted his user to have to change their password every so many hours.

;^)

Pete

Pete
Paula J Frazer-Campbell
Honored Contributor

Re: automatic system shutdown with user logon

Hi Pete

I wonder if that user did get a change passwd every few hours?


It pays not to upset your sysadmin !!!!!



Paula

If you can spell SysAdmin then you is one - anon
Nsikan_1
Advisor

Re: automatic system shutdown with user logon

Hi all,
It's for security issues.
U can create a user only to be shuting down your system.This will prevent from doing anything.
Rgds.
Nsikan.