File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Script to change User to root Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Script to change User to root" Watch "Script to change User to root" New topic

Script to change User to root

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I want to write a script called say that when i execute it it would change the user logged in to root
Please how do i accomplish this
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

More likely you just want to change the effective user ID. The "su" and "sudo" commands do that.

An IDE is no substitute for an Intelligent Developer.
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

Using sudo is much less of a security hole than setting to root. You really should lookup and use sudo
I agree. Here's the link:
subject: Script to change User to root
It's not a secret anymore!