[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

RHEL 6 su command question

Posted on 2011-03-22
3
Medium Priority
?
758 Views
Last Modified: 2013-11-17
What is the difference between

su tcn

Open in new window


and

su - tcn

Open in new window


I looked up the man page and it states:

Change the effective user id and group id to that of USER.

-, -l, --login

Open in new window


Doesn't "su tcn" change the user id.  Would this command not change the group id without the dash ?
0
Comment
Question by:Los Angeles1
  • 2
3 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 35189956
There is a difference between userid/groupid and "effective" userid/groupid.

The effective IDs are only changed with "su -", and also the login profile of the target user is only executed with "su -".

wmp
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35189961
With su you just become that user but home directory will not be changed and it will not read his .bash_profile and .bashrc so env variable set by him will not be available but

With su - it is like you have logged in with that user. home directory will be changed. Path will be set according that user. It will read that users .bash_profile and .bashrc, all custome env variable will be available.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 35190030
Sorry, seems I've been typing too fast!

I should have written

Only the effective IDs are changed with "su" alone, the login profile of the target user is only executed with "su -".
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question