1824997 Members
2393 Online
109678 Solutions
New Discussion юеВ

su and su-

 
SOLVED
Go to solution
sanalkumar
Occasional Contributor

su and su-

i am new to hp unix can any one tell the differnce between su and su- can you suggest any books for knowing ssh..thanks in advance
6 REPLIES 6
Anshumali
Esteemed Contributor
Solution

Re: su and su-

If the - flag is specified, the su command initializes the user environment else no.
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Jeeshan
Honored Contributor

Re: su and su-

"su" is equiv "su root" and "su -" equiv "su - root"

the diff between "su" and "su -" is "su -" you log in as a root with the env setting/profile (i.e you really log in as a root).

if you "su" only then basically you just "borrow" the root permission without having all the root env setting/profile.
a warrior never quits
Anshumali
Esteemed Contributor

Re: su and su-

Ahsan, what if i am root already and do a
su - (username) ?

su isn;t limited for gaining root access. :)
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Aneesh Mohan
Honored Contributor

Re: su and su-

Sanal,

su login :- to switch login without executing profile/env variable

su - login :- to switch login with executing the login profile/env


Thanks,

Aneesh
sanalkumar
Occasional Contributor

Re: su and su-

Thanks to all of you for the immediate response.
Mridul Shrivastava
Honored Contributor

Re: su and su-

su means switch user and as its expansion describes it is used for switching user.. It could be root to non-rrot user or vice versa...

The difference between su and su - is already been explained by Anshumali.
Time has a wonderful way of weeding out the trivial