[kwlug-disc] Johnny Cash: A boy name SU

Tim Laurence timdaman at gmail.com
Wed May 21 10:53:18 EDT 2014


I have found
   "sudo bash"
gives me odd results because it uses a mix of the login and root
environmental configurations.

It find it is better to do
  sudo su -
because that reinitializes the environment to be a pure root one. A
shortcut for this is
  sudo -i
which does the reinitialization within sudo. This can even be combined with
-u
   sudo -u database_user -i
to gain access to user accounts that may have highly customized
environments such as I have found with several database servers.

One last tip for sudo. If you have ever found yourself editing  a config
file in vi and find out, when you go to write, that you forgot to edit as
root and the file is read only to you. Try this vi command
    :w !sudo tee %
That translates to write to pipe connected to sudo which in turn pipes to
tee which is passed the original file-name as a output target.

--Tim


On Wed, May 21, 2014 at 10:35 AM, Khalid Baheyeldin <kb at 2bits.com> wrote:

> I use screen to open many shells, and in one "window", I do:
>
> $ su -
>
> Then enter the password
>
> I am in a root shell in that "window" forever.
>
> Or, if it is a machine that you are not logged into all the time, just do:
>
> $ sudo bash
> Then enter the password
>
>
>
>
> On Wed, May 21, 2014 at 10:20 AM, John Johnson <jvj at golden.net> wrote:
>
>> On 2014-05-21 10:13, Khalid Baheyeldin wrote:
>>
>>> Is it just me or what? The su has always been in Linux since forever.
>>>
>>
>> It is me. Not you.
>>
>> Many years ago I looked for SU and was advised to do all 'root' stuff
>> with $ sudo.
>> I did not know about $ sudo su<ENTER> until recently.
>>
>>
>> JohnJ
>>
>>
>>
>>
>>
>> _______________________________________________
>> kwlug-disc mailing list
>> kwlug-disc at kwlug.org
>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>
>
>
>
> --
> Khalid M. Baheyeldin
> 2bits.com, Inc.
> Fast Reliable Drupal
> Drupal optimization, development, customization and consulting.
> Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
> Simplicity is the ultimate sophistication. --   Leonardo da Vinci
> For every complex problem, there is an answer that is clear, simple, and
> wrong." -- H.L. Mencken
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140521/e429c8b7/attachment.htm>


More information about the kwlug-disc mailing list