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
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/
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.
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