Solved

RHEL 6 su command question

Posted on 2011-03-22
3
752 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

688 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