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

Khalid Baheyeldin kb at 2bits.com
Wed May 21 11:45:32 EDT 2014


I usually do it as follows:

$ vi config_file
[File wold not save]
:w /tmp/k
:q!

$ sudo vi config_file
:1,$d
:r /tmp/k

A bit too long compared to Tim's shortcut ...



On Wed, May 21, 2014 at 11:26 AM, L.D. Paniak
<ldpaniak at fourpisolutions.com>wrote:

>  Thanks Tim!
> A solution to one of the great unsolved (for me at least) problems of the
> universe: how to cleanly save that file you have no right to save after you
> have made several dozen changes.
>
> I challenge the emacs crowd to come up with an equivalent.
>
>
> On 05/21/2014 10:53 AM, Tim Laurence wrote:
>
>   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
>>
>>
>
>
> _______________________________________________
> kwlug-disc mailing listkwlug-disc at kwlug.orghttp://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140521/25ac516e/attachment.htm>


More information about the kwlug-disc mailing list