go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Java Deploying » sudo vs su commands under Linux / UNIX / BSD / AIX / HP-UX
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: sudo vs su commands under Linux / UNIX / BSD / AIX / HP-UX
Unix
member
offline   
 
posts: 7
joined: 10/06/2011
from: Cupertino, CA
  posted on: 10/06/2011 03:10:59 PM    Edit  |   Quote  |   Report 
sudo vs su commands under Linux / UNIX / BSD / AIX / HP-UX
The Unix commands sudo and su allow access to other commands as a different user.

The sudo command

The sudo command stands for "superuser do". It is often used when certain rights are not granted to the current user. For example,

  $ mkdir /usr/local/java
  mkdir: cannot create directory `/usr/local/java': Permission denied

The command prompts you for your personal password and confirms your request to execute a command by checking a file, called sudoers, which the system administrator configures. Using the sudoers file, system administrators can give certain users or groups access to some or all commands without those users having to know the root password. It also logs all commands and arguments so there is a record of who used it for what, and when.

To use the sudo command, at the command prompt, enter:
  sudo command

Replace command with the command for which you want to use sudo. For example
  $ sudo mkdir /usr/local/java

 Profile | Reply Points Earned: 0
Unix
member
offline   
 
posts: 7
joined: 10/06/2011
from: Cupertino, CA
  posted on: 10/06/2011 03:19:02 PM    Edit  |   Quote  |   Report 
The su command

The su command stands for "switch user", and allows you to become another user. To use the su command on a per-command basis, enter:
  su user -c command

Replace user with the name of the account which you'd like to run the command as, and command with the command you need to run as another user. To switch users before running many commands, enter:
  su user

The user feature is optional; if you don't provide a user, the su command defaults to the root account, which in Unix is the system administrator account. In either case, you'll be prompted for the password associated with the account for which you're trying to run the command. If you supply a user, you will be logged in as that account until you exit it.

To exit, press Ctrl-d or type exit at the command prompt.

 Profile | Reply Points Earned: 0

 
Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.