PCLinuxOS-Forums
News: ...FLASH!!! ...New PCLinuxOS Testing board now open. Register today! Be an active contributor to the PCLinuxOS future! ... Read all about it now, on THIS forum!!!..
 
*
Welcome, Guest. Please login or register. May 27, 2012, 03:35:31 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: su and su - commands  (Read 666 times)
Just18
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 4637


MLUs Forever!


« on: July 15, 2011, 05:15:40 PM »

Quote
Just su to root and use the rest of the line.
Should not that be su - ?

If using one of the newer ISOs you may find that "su" is aliased to "su -" .......  you can find out what aliases are set up by typing in a terminal

alias

Logged

MLUs rule the roost!

Linux XPS 3.2.17-pclos1.pae.bfs  32 bit
Intel(R) Core(TM)2 Quad  CPU   Q9450  @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech ‎DVB-T 2 USB DTT
dvhenry
Full Member
***
Offline Offline

Posts: 101


« Reply #1 on: July 15, 2011, 06:25:07 PM »

On my system that alias is not set up, but I use a variety of distro's,  so will stick to my already formed habit of typing "su -".
Logged
johnmart
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 741


Make Love Not War


« Reply #2 on: July 15, 2011, 09:26:06 PM »

Excuse me for butting in with an off-topic question.
Is there a downside to using su -, instead of su?
I never use su - unless I am following someone's advice.
My concern is that the results of certain commands from root environment could cause an ownership issue later on.
But I am a dummy.  Grin
Unfounded concern?
Logged

Acer Aspire, Intel core2 2.20GHz, ‎Graphics nVidia ‎G98M [GeForce G 105M], 2gb ram, Wireless Intel Link 5100

Why, any 5 year old child could understand this.
Somebody bring me a 5 year old.
Groucho
jfdesign
Full Member
***
Offline Offline

Posts: 209


« Reply #3 on: July 16, 2011, 03:59:46 AM »

Quote
Just su to root and use the rest of the line.
Should not that be su - ?

If using one of the newer ISOs you may find that "su" is aliased to "su -" .......  you can find out what aliases are set up by typing in a terminal

alias



i'm not gonna install the new iso in near time because my system is in good shape, but i want that alias. may i know how tex set that alias ? if in .bash_profile ... what the syntax ?
tia
Logged
Old-Polack
Administrator
Hero Member
*****
Offline Offline

Posts: 9695


----IOFLU----


« Reply #4 on: July 16, 2011, 04:16:56 AM »

Quote
Just su to root and use the rest of the line.
Should not that be su - ?

If using one of the newer ISOs you may find that "su" is aliased to "su -" .......  you can find out what aliases are set up by typing in a terminal

alias



i'm not gonna install the new iso in near time because my system is in good shape, but i want that alias. may i know how tex set that alias ? if in .bash_profile ... what the syntax ?
tia

You can add a line to your ~/.bashrc;

alias su='su -'

Save the file and that's it.
Logged

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...
Just18
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 4637


MLUs Forever!


« Reply #5 on: July 16, 2011, 04:20:33 AM »

Quote
Just su to root and use the rest of the line.
Should not that be su - ?


If using one of the newer ISOs you may find that "su" is aliased to "su -" .......  you can find out what aliases are set up by typing in a terminal

alias




i'm not gonna install the new iso in near time because my system is in good shape, but i want that alias. may i know how tex set that alias ? if in .bash_profile ... what the syntax ?
tia


http://www.mediacollege.com/linux/command/alias.html
Logged

MLUs rule the roost!

Linux XPS 3.2.17-pclos1.pae.bfs  32 bit
Intel(R) Core(TM)2 Quad  CPU   Q9450  @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech ‎DVB-T 2 USB DTT
Bald Brick
PCLinuxOS Tester
Hero Member
*******
Online Online

Posts: 5150


I'm going South


« Reply #6 on: July 16, 2011, 05:35:36 AM »

Excuse me for butting in with an off-topic question.
Is there a downside to using su -, instead of su?

Perhaps a few minor annoyances.

For instance: when you run "su" your current directory remains your current directory; but after running "su -" your current directory always becomes /root. So if you want to run a command on a file in what used to be your current directory, you have to specify the path to it, or cd back to it.

Note that if you su to root and a program needs root's envirenment, you don't have to exit and start again with "su -" and root's password; just type "su -" as root and you'll get the whole environment.

Quote
I never use su - unless I am following someone's advice.
My concern is that the results of certain commands from root environment could cause an ownership issue later on.
But I am a dummy.  Grin
Unfounded concern?

If you create a file or a folder as root that file or folder will be owned by root regardless of whether you've run "su" or "su -" to become root.
Logged

If it ain't broke
hit harder!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D
jfdesign
Full Member
***
Offline Offline

Posts: 209


« Reply #7 on: July 16, 2011, 07:52:45 AM »

thank you old_polack and just19 for the help.  Grin
Logged
dvhenry
Full Member
***
Offline Offline

Posts: 101


« Reply #8 on: July 16, 2011, 07:35:18 PM »

A discussion on "su" verses "su -" that may be of interest to some is http://forums.opensuse.org/new-user-how-faq-read-only/unreviewed-how-faq/424498-become-su-terminal-howto.html
The discussion starts at post #7, and gets more interesting and detailed around post #20.
 It is from the openSUSE forums, but contains relevant info.
Logged
johnmart
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 741


Make Love Not War


« Reply #9 on: July 16, 2011, 09:00:34 PM »

Thanks BaldBrick. Cleared it up for me.  Smiley
Thanks too dvhenry. I'll give that a look. Haven't been there since suse.6, or was it 9?  Smiley
Logged

Acer Aspire, Intel core2 2.20GHz, ‎Graphics nVidia ‎G98M [GeForce G 105M], 2gb ram, Wireless Intel Link 5100

Why, any 5 year old child could understand this.
Somebody bring me a 5 year old.
Groucho
dvhenry
Full Member
***
Offline Offline

Posts: 101


« Reply #10 on: July 17, 2011, 12:06:23 AM »

Quote
Thanks too dvhenry. I'll give that a look. Haven't been there since suse.6, or was it 9?

It's an interesting read, and worth a look.

At this point, might I suggest that a moderator move posts from reply #15 on, to a separate thread with an appropriate title, as this has become 2 subjects.
Those interested in variations of the "su" command are not likely to start looking in a thread about UUIDs.
Logged
Archie
Global Moderator
Hero Member
*****
Offline Offline

Posts: 6885


I will never forget you, uhhh...


« Reply #11 on: August 01, 2011, 02:05:39 AM »

Where are these new set of aliases hardcoded??

I've looked in the .bashrc, /etc/profile, /etc/profile.d/60alias.sh ... and can't seem to find it.
Logged

AS
Global Moderator
Hero Member
*****
Offline Offline

Posts: 4139

Have a nice ... night!


« Reply #12 on: August 01, 2011, 03:03:10 AM »

Where are these new set of aliases hardcoded??

I've looked in the .bashrc, /etc/profile, /etc/profile.d/60alias.sh ... and can't seem to find it.

/home/<user>/.bashrc

'su=su -' alias has been added in recent PCLinuxOS versions (kde-2011-06, -kde-minime-2011-07, ...),
you can't find it in your installation if you are rolling up from previous releases   Wink

AS
Logged
Archie
Global Moderator
Hero Member
*****
Offline Offline

Posts: 6885


I will never forget you, uhhh...


« Reply #13 on: August 01, 2011, 03:31:03 AM »

Thanks, AS.

I must be getting blind. I was expecting a whole bunch of aliases, i.e. .bash_aliases ... and thanks to you, I found it at the end of the .bashrc line.   Lips Sealed   LOL.

Logged

Vortеx
Hero Member
*****
Offline Offline

Posts: 2010


Vorteks without the Secretary


« Reply #14 on: August 01, 2011, 10:07:13 AM »

There's a related command unalias for those interested in. Wink
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM