Mac newbie question: editing files in folders owned by root

View: New views
12 Messages — Rating Filter:   Alert me  

Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to edit some application template files that are embedded down
two "package" levels - the packages and the files in question are owned
by root.  And I want to be able to write safe copies of the originals to
the same folder.

Is there a simple way to do this in BBEdit?  ie a "sudo" equivalent?

I'm still learning how this stuff works.

DN

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 17.12 +1000 2008-05-06, David Nicholls wrote:
>I want to edit some application template files that are embedded down two "package" levels - the packages and the files in question are owned by root.  And I want to be able to write safe copies of the originals to the same folder.
>
>Is there a simple way to do this in BBEdit?  ie a "sudo" equivalent?

Yes, BBEdit prompts you to authenticate when you try to save a file that you don't have write permissions for (after warning you when you start editing it). Much like a sudo but afterwards.

"Make backup before saving" with the "Use document's folder" option under Text files in Preferences seems to be right for for the copy but I'm not sure how BBEdit handles a situation where you don't have write permissions to the folder. Just try it.
--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:joh-n@...
 (spam-safe email address, replace '-' with 'a')

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan Solve wrote:

> At 17.12 +1000 2008-05-06, David Nicholls wrote:
>> I want to edit some application template files that are embedded
>> down two "package" levels - the packages and the files in question
>> are owned by root.  And I want to be able to write safe copies of
>> the originals to the same folder.
>>
>> Is there a simple way to do this in BBEdit?  ie a "sudo"
>> equivalent?
>
> Yes, BBEdit prompts you to authenticate when you try to save a file
> that you don't have write permissions for (after warning you when you
> start editing it). Much like a sudo but afterwards.
>
> "Make backup before saving" with the "Use document's folder" option
> under Text files in Preferences seems to be right for for the copy
> but I'm not sure how BBEdit handles a situation where you don't have
> write permissions to the folder. Just try it.

I had done that and got a "-5000 error code". Both for saving the safe
copy and trying to save the existing file.  No warning until failure.

Maybe I'll need to go in using Terminal?

DN



--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Charlie Garrison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good afternoon,

On 6/5/08 at 5:12 PM +1000, David Nicholls <dcn@...> wrote:

>I want to edit some application template files that are
>embedded down two "package" levels - the packages and the files
>in question are owned by root.  And I want to be able to write
>safe copies of the originals to the same folder.
>
>Is there a simple way to do this in BBEdit?  ie a "sudo" equivalent?
>
>I'm still learning how this stuff works.

Is the pencil icon marked with a red cross? Click it and you
should be able to unlock the file for writing.


Charlie

--
    Charlie Garrison  <garrison@...>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charlie Garrison wrote:

> Good afternoon,
>
> On 6/5/08 at 5:12 PM +1000, David Nicholls <dcn@...> wrote:
>
>> I want to edit some application template files that are embedded down
>> two "package" levels - the packages and the files in question are
>> owned by root.  And I want to be able to write safe copies of the
>> originals to the same folder.
>>
>> Is there a simple way to do this in BBEdit?  ie a "sudo" equivalent?
>>
>> I'm still learning how this stuff works.
>
> Is the pencil icon marked with a red cross? Click it and you should be
> able to unlock the file for writing.

Yep, I did that, said yes to open for editing and tried to save as a
safe copy, 5000 error again.  I think it must be a folder permissions
problem.

DN

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Charlie Garrison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good evening,

On 6/5/08 at 6:09 PM +1000, David Nicholls <dcn@...> wrote:

>Yep, I did that, said yes to open for editing and tried to save
>as a safe copy, 5000 error again.  I think it must be a folder
>permissions problem.

Sorry, missed that you wanted to save a copy. I always use the
shell to make a copy and then go from there.

As far as I know, BBEdit doesn't have a way to create new files
(save as) in a protected directory. You should be able to make a
copy using 'cp' from a BBEdit worksheet, but I haven't tried it.
Click the lock first to allow sudo (type) access in the worksheet.


Charlie

--
    Charlie Garrison  <garrison@...>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charlie Garrison wrote:

> Good evening,
>
> On 6/5/08 at 6:09 PM +1000, David Nicholls <dcn@...> wrote:
>
>> Yep, I did that, said yes to open for editing and tried to save as a
>> safe copy, 5000 error again.  I think it must be a folder permissions
>> problem.
>
> Sorry, missed that you wanted to save a copy. I always use the shell to
> make a copy and then go from there.
>
> As far as I know, BBEdit doesn't have a way to create new files (save
> as) in a protected directory. You should be able to make a copy using
> 'cp' from a BBEdit worksheet, but I haven't tried it. Click the lock
> first to allow sudo (type) access in the worksheet.

Thanks.  Now I've struck another block: how to I get inside an
application's contents?

The full path to the file I want is /Applications/Adobe Lightroom.app
/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
/default_html.lrwebengine/detail.html

where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine are
all applications whose contents I can explore using Finder.  But trying
to use cd in Terminal to get inside Adobe Lightroom.app (etc) tells me
there's no such directory.

Is this possible?  If not, perhaps I can save the original file to
somewhere normal and use it as a reference if I need to revert the
edited file.

I don't want to edit anything until I know I can get back to the
starting point.

DN

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Nicholls wrote:

> Thanks.  Now I've struck another block: how to I get inside an
> application's contents?
>
> The full path to the file I want is /Applications/Adobe Lightroom.app
> /Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
> /default_html.lrwebengine/detail.html
>
> where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine are
> all applications whose contents I can explore using Finder.  But trying
> to use cd in Terminal to get inside Adobe Lightroom.app (etc) tells me
> there's no such directory.
>
> Is this possible?  If not, perhaps I can save the original file to
> somewhere normal and use it as a reference if I need to revert the
> edited file.


I found a script called Open Terminal Here which is added to the Finder
toolbar and opens terminal where you've navigated to.
http://www.entropy.ch/software/applescript/

Problem solved. I think.

DN

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Charlie Garrison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good evening,

On 6/5/08 at 7:56 PM +1000, David Nicholls <dcn@...> wrote:

>The full path to the file I want is /Applications/Adobe Lightroom.app
>/Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
>/default_html.lrwebengine/detail.html
>
>where Adobe Ligthroom.app, Web.agmodule and
>default_html.lrwebengine are all applications whose contents I
>can explore using Finder.  But trying to use cd in Terminal to
>get inside Adobe Lightroom.app (etc) tells me there's no such directory.

How are you entering the command? I'm guessing you aren't
escaping the space or quoting the full path. I find tab
completion to be a great way to have special characters escaped
for me by bash.


Charlie

--
    Charlie Garrison  <garrison@...>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by David Nicholls-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charlie Garrison wrote:

>> The full path to the file I want is /Applications/Adobe Lightroom.app
>> /Contents/PlugIns/Web.agmodule/Contents/Resources/galleries
>> /default_html.lrwebengine/detail.html
>>
>> where Adobe Ligthroom.app, Web.agmodule and default_html.lrwebengine
>> are all applications whose contents I can explore using Finder.  But
>> trying to use cd in Terminal to get inside Adobe Lightroom.app (etc)
>> tells me there's no such directory.
>
> How are you entering the command? I'm guessing you aren't escaping the
> space or quoting the full path. I find tab completion to be a great way
> to have special characters escaped for me by bash.


You're undoubtedly correct.  I'm only just weaned off MS DOS commends
(yeccchh!) so my Unix is a bit vestigial still!

DN

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Doug McNutt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 17:12 +1000 5/6/08, David Nicholls wrote:
>I want to edit some application template files that are embedded down two "package" levels - the packages and the files in question are owned by root.  And I want to be able to write safe copies of the originals to the same folder.
>
>Is there a simple way to do this in BBEdit?  ie a "sudo" equivalent?

I had the same kind of problem yesterday with gedit.  The solution was to create the backup file with Terminal and then go into the editor with a command line.

cd /etc
sudo touch hosts~
sudo gedit hosts

I suspect that the bbedit tool would do something similar

cd your_package_directory
sudo touch the bbedit backup_file_you_expect
sudo bbedit  yourpackagedirectory/the_file_to_be_edited

In any case getting into files and directories that Finder really doesn't want to show is pretty much always easier with the bbedit tool than with the Open or Save-As menu items.

You can also use the chmod tool with sudo to open up permissions on the files and directories that bother you. it won't affect the way they work unless some program - ssh - demands that they be closed off for security reasons.

man chmod  # for more


--
-->  The best programming tool is a soldering iron <--

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>


Re: Mac newbie question: editing files in folders owned by root

by Charlie Garrison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good morning,

On 6/5/08 at 8:38 AM -0600, Doug McNutt
<douglist@...> wrote:

>I suspect that the bbedit tool would do something similar
>
>cd your_package_directory
>sudo touch the bbedit backup_file_you_expect
>sudo bbedit  yourpackagedirectory/the_file_to_be_edited

Using 'sudo bbedit' will not gain you anything over just
'bbedit'. The command line tool is not an editor; it's just a
nice/simple way to get BBEdit to open (or create) documents.
BBEdit will still need to have access to the file before it can
read/save. So all the same rules discussed previously still apply.


Charlie

--
    Charlie Garrison  <garrison@...>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <support@...>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <bbedit-talk-off@...>

LightInTheBox - Buy quality products at wholesale price!