[ug-bosug] su and sudo su in Open Indiana

2 views
Skip to first unread message

Balachandran Sivakumar

unread,
Dec 18, 2011, 12:47:58 PM12/18/11
to Bangalore OpenSolaris User Group
Hi, I am using open indiana, bulid 151a. Here is what I observe

sgana@enlighten:~$ whoami
sgana
sgana@enlighten:~$ echo $HOME
/home/sgana
sgana@enlighten:~$ pwd
/home/sgana
sgana@enlighten:~$ su
Password: <Enter root's passwd>
sgana@enlighten:~# whoami
root
sgana@enlighten:~# echo $HOME
/home/sgana
sgana@enlighten:~# pwd
/home/sgana
sgana@enlighten:~#
....
....
sgana@enlighten:~$ sudo su
Password: <Enter sgana's passwd>
root@enlighten:/home/sgana# echo $HOME
/root
root@enlighten:/home/sgana# exit

Isn't this behaviour a little odd ? In my opinion both su and sudo su
should behave the same way. They should allow be to be root. But why
do we have this kind of behaviour ? Was it introduced for a specific
reason ? Thanks


--
Thank you
Balachandran Sivakumar

Arise Awake and stop not till the goal is reached.
                                                             - Swami Vivekananda

Mail: benig...@gmail.com
Blog: http://benignbala.wordpress.com/
_______________________________________________
ug-bosug mailing list
List-Unsubscribe: mailto:ug-bosug-u...@opensolaris.org
List-Owner: mailto:ug-bosu...@opensolaris.org
List-Archives: http://www.opensolaris.org/jive/forum.jspa?forumID=54

Moinak Ghosh

unread,
Dec 18, 2011, 1:35:05 PM12/18/11
to Bangalore OpenSolaris User Group
On Sun, Dec 18, 2011 at 11:17 PM, Balachandran Sivakumar
<benig...@gmail.com> wrote:
> Hi, I am using open indiana, bulid 151a. Here is what I observe
>
[...]>

> Isn't this behaviour a little odd ? In my opinion both su and sudo su
> should behave the same way. They should allow be to be root. But why
> do we have this kind of behaviour ? Was it introduced for a specific
> reason ? Thanks
>

su only sets the effective user id of the current shell without
actually logging in as root or the given user. The sudo command
on the other hand starts off a new user login shell. If you want
same behavior use 'su -' which starts off a new user shell.
Check the man page for more details.

Regards,
Moinak.
--
================================
http://www.belenix.org/
http://moinakg.wordpress.com/

Moinak Ghosh

unread,
Dec 18, 2011, 1:39:03 PM12/18/11
to Bangalore OpenSolaris User Group
On Mon, Dec 19, 2011 at 12:05 AM, Moinak Ghosh <moi...@belenix.org> wrote:
> On Sun, Dec 18, 2011 at 11:17 PM, Balachandran Sivakumar
> <benig...@gmail.com> wrote:
>> Hi, I am using open indiana, bulid 151a. Here is what I observe
>>
> [...]>
>> Isn't this behaviour a little odd ? In my opinion both su and sudo su
>> should behave the same way. They should allow be to be root. But why
>> do we have this kind of behaviour ? Was it introduced for a specific
>> reason ? Thanks
>>
>
>   su only sets the effective user id of the current shell without

Rectifying myself here. It actually starts a new shell with the effective
user id set but without the full login environment of the new user.

Balachandran Sivakumar

unread,
Dec 18, 2011, 2:17:50 PM12/18/11
to Bangalore OpenSolaris User Group
Hi,

On Mon, Dec 19, 2011 at 12:05 AM, Moinak Ghosh <moi...@belenix.org> wrote:

> On Sun, Dec 18, 2011 at 11:17 PM, Balachandran Sivakumar
> <benig...@gmail.com> wrote:
>
>   su only sets the effective user id of the current shell without
>   actually logging in as root or the given user. The sudo command
>   on the other hand starts off a new user login shell. If you want
>   same behavior use 'su -' which starts off a new user shell.
>   Check the man page for more details.
>

Yeah. That was my problem. I normally use "su -". But somehow
did su and ended up with this question :) Also the behaviour is
different from what I am used to in GNU/Linux. Thanks for the
clarification.

--
Thank you
Balachandran Sivakumar

Arise Awake and stop not till the goal is reached.
                                                             - Swami Vivekananda

Reply all
Reply to author
Forward
0 new messages