LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-19-2007, 07:39 AM   #1
guguma
LQ Newbie
 
Registered: Feb 2007
Posts: 10

Rep: Reputation: 0
Differance between su <username> and su <username> -


What exactly is the difference between

Code:
su <username>
and

Code:
su username -
or
Code:
su username -l
I read the man page but I cannot quite get it.

I want to change the user in such a way so that the user will not break anything and use only the configuration files (.bashrc and bash_profile and other ones)

I tried to test both options but really do not know what to test.

EX:

1. I invoked

Code:
gedit /etc/fstab
both does not let it do it.

2. I invoked

Code:
gedit .bashrc
it does execute in GUI (Gnome) but gives a warning that there is an authentication failure. Although it gives that it lets me change and save the file. The authentication I think is for the GUI (nautilus). But because the owner of the file is the user it lets it save the file. but should not it prevented the execution of gedit in the first place?


I am really stuck please help

Thanks in advance.
 
Old 08-19-2007, 07:52 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Most commonly, using "su" to get root privileges:

su ____gives you root privileges, but leaves you in the previous user's environment (eg $HOME directory, config, files, etc.

su - ____changes to root's environment (Can be significant--eg--when root has a different $PATH variable.
 
Old 08-19-2007, 12:34 PM   #3
guguma
LQ Newbie
 
Registered: Feb 2007
Posts: 10

Original Poster
Rep: Reputation: 0
but what about

Code:
su <username> -l
I think that this is nearly the same as logging in as <username>. I am asking the difference between using - (-l) and not using them.

Either you use them or not you login as <username>. But what does the - (-l) add or change

Thanks
 
Old 08-19-2007, 01:01 PM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
- and -l are the same. They both make the shell a login shell meaning that you inherit that users environment (paths and that sort of stuff). Simply using su will start a new shell but not let you inherit that users environment.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why "bash-2.05b$" in Terminal instead of "username@localhost username" jayelitumbiolo Linux - General 9 10-04-2009 03:16 AM
can i change username bobber Debian 2 01-19-2006 02:34 AM
useradd: invalid username username$ engyeow Fedora 5 12-05-2004 04:35 AM
apache username tethysgods Linux - Software 6 07-08-2004 09:45 AM
Username and Password dance2die Arch 3 09-01-2003 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration